Modern Mainstays: Top Runtimes Embracing Work-Stealing

Work-stealing is now a cornerstone of many modern parallel computing systems, including Java's Fork/Join Framework, Go's Goroutines, Intel Threading Building Blocks (TBB), .NET Task Parallel Library, Rust's Tokio, and OpenMP tasking.

The top 3

  1. Java's ForkJoinPool: Dual Queue Work-Stealing: Java's ForkJoinPool utilizes a work-stealing algorithm where each worker maintains a double-ended queue (deque), processing its own tasks Last-In, First-Out (LIFO) and stealing tasks from other idle workers' deques First-In, First-Out (FIFO), a design that underpins Java's parallel streams.
  2. Go Runtime: M:N Scheduler's Work-Stealing Core: The Go runtime employs an M:N scheduler, mapping M goroutines to N operating system threads. Work-stealing is a crucial mechanism within this scheduler to dynamically balance workloads across processor cores and ensure efficient execution of goroutines.
  3. Java's ForkJoinPool: Dual-Queue Work-Stealing: Java's ForkJoinPool, introduced in Java 7, implements a work-stealing algorithm using a deque (double-ended queue) for each worker thread. Workers primarily take tasks from their own deque's head, but when idle, they 'steal' tasks from the tail of another random worker's deque to balance the load.

Sources

Open the full topic