5.7. Coordination Data Structures and Threading Enhancements

In .NET 4.0, the thread pool has been enhanced, and a number of new synchronization classes have been introduced.

5.7.1. Thread Pool Enhancements

Creating many threads to perform small amounts of work can actually end up taking longer than performing the work on a single thread. This is due to time slicing and the overhead involved in locking, and adding and removing items to the thread pools queue.

Previously, the queue of work in the thread pool was held in a linked list structure and utilized a monitor lock. Microsoft improved this by changing to a data structure that is lock-free and involves the garbage collector (GC) doing less work. Microsoft says that this new structure is ...

Get Introducing .NET 4.0: with Visual Studio 2010 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.