Lock Free Coding Addendum
October 3, 2007 on 10:38 pm | In .NET Coding |Ok so something strikes me… the only thing that makes sense in multi client lock free coding is to have a shared, un-orderd data structure between all process elements. This strikes me as a little odd because you have to ensure the thread safety of this shared structure… I’m going to have to read more on this, because I’m now throughly confused… Maybe lock free isn’t the best methodology for client-server paradigms (that don’t broadcast data to each client simultaneously, and must maintain open ‘indexed’ tcp connections) Sure you can safeguard a collection, like the hash structure of tcp handles… but… don’t you have to put them in critical regions first? This is what i get for learning this stuff in my “spare time”… you can see how often I get that.
Comment added After the Fact: I apologize for sounding like such an idiot on this subject, I’m just trying to get my head into the multi-core ready ideas, and I’m having a bit of a time at it… All of your emails and comments are very helpful. So Thanks, and I’m trying, I’m really not as dumb as my (lack of) conceptualization of Lock-Freeness would suggest.
3 Comments »
RSS feed for comments on this post. TrackBack URI
Leave a comment
Powered by WordPress with Pool theme design by Borja Fernandez.
Entries and comments feeds.
Valid XHTML and CSS. ^Top^

In C# you can create a thread-safe collection by wrapping around your queue with Queue.Synchronised. What it does is creating a lock around the Enqueue/Dequeue operations so that only one thread a time can perform these operations on the same instance of the queue. There are scalability issues: if a server has X threads accessing the queue the lock will cause a performance drop due to serialization of execution. That\’s where lock-free stack, queue, hash etc algorithms help. They allow threads to enter the same dequeue/enqueue operation simultaneously and progress in parallel operation down to a single CAS (compare-and-swap) primitive which is called Interlocked.CompareExchange in C#.
Comment by passenger — October 19, 2007 #
Please do enlighten me of which algorithms you speak, because so far all I can find are things involving System.Collections and SynchRoot, or custom version of it that are like that.. which has till now been very disappointing. Is there a library somewhere on this? (Sorry about making you hit a captcha to post here, I got spammed ridiculously before I did that though.)
Comment by Dave — October 19, 2007 #
found something, I don’t know how I missed it before…
http://www.boyet.com/Articles/LockFreeLimitedPriorityQ.html
Comment by Dave — October 19, 2007 #