Work-stealing is a performance optimization technique for a thread pool. Every thread pool maintains a single global queue of tasks that are created inside a process. In Chapter 1, Introduction to Parallel Programming, we learned that the thread pool maintains an optimal number of worker threads to work on tasks. The ThreadPool also maintains a thread global queue, where it queues all the work items before they can be assigned to available threads. Since this is a single queue and we work in multithreaded scenarios, we need to implement thread-safety using synchronization primitives. With a single global queue, synchronization leads to performance loss.
The .NET Framework works around this performance loss by introducing the concept of local queues, which are managed by threads. Each thread has access to a global queue and also maintains its own thread-local...