All about Async/Await, System.Threading.Tasks, System.Collections.Concurrent, System.Linq, and more…
.NET 4 introduces new data structures designed to simplify thread-safe access to shared data, and to increase the performance and scalability of multi-threaded applications. To best take advantage of these data structures, it helps to understand their performance characteristics in different scenarios.
Chunyan Song, Emad Omara and Mike Liddell measured the performance of four new concurrent collection types: ConcurrentQueue(T), ConcurrentStack(T), ConcurrentBag(T), and ConcurrentDictionary(TKey, TValue), and published their findings in this paper:
(This paper and many more are available through the Parallel Computing Developer Center on MSDN at http://msdn.microsoft.com/en-us/concurrency/ee851578.aspx.)
link to paper is dead.
@offler: Thanks. Fixed link.
There's a few shortcomings in this paper:
1) What is the memory overhead of these collections?
2) In a scenario with many more reads than writes, how do these collections compare to ReaderWriterLockSlim synchronized collection?
3) The paper assumes internal synchronization of collections is required but does not discuss the fact the internal synchronization often synchronizes too much (multiple access as part of an algorithm will incur multiple locks). I would have liked to see some examples comparing concurrent collections vs externally synchronized collection rather than naive internally synchronized collection.
4) Would have been interesting to see some examples with Map/Reduce since it seems to me this would be the kind of scenario where one would want to use concurrent internally synchronized collections.