Does anyone know if there are any lock-free container libraries available for .NET ?
Preferably something that is proven to work and faster than the Synchronized wrappers we have in .NET.
I have found some articles on the .NET, but none of them specify any speed benchmarking, nor do they inspire much confidence in their reliability.
Thanks
Stacks make for a simple case study, since the operations on stacks are very simple. The basic principle behind the implementation is that a thread will create a new version of the top of the stack and if no other thread has modified the stack, the change will be made public.
Lock-free queue is a queue applying to concurrency but without locking. When using lock-free queue, slow or stopped processes do not prevent other processes from accessing data in it. Lock-free queue has two main interfaces just like normal queue: Enqueue.
"For certain workloads" could also be interpreted as "for those workloads that can be synchronized with a lock free data structure". In other words they are always faster, but cannot be always applied.
lock-free usually doesn't mean "any lock", it means something like transactional memory, or optimistic design, where you don't use lock for every operation, but once in a while (for rolling back or doing transaction) - some kind of lock will be needed.
Late, but better than never I thought I would add Julian Bucknalls articles to this list.
But he does not have performance numbers. In my testing of his structures the list scaled well compared to locking (very low kernel usage compared to ReaderWriterLock).
His blog has a series of articles on lock free structures in C#.
LOCK-FREE DATA STRUCTURES: THE STACK
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With