Concurrency

Work stealing

Idle workers steal pending tasks from busy workers' queues.


In plain terms

Each worker has a deque; thieves take from the back, owner from the front. Java ForkJoinPool, Go scheduler, Rust Rayon, .NET TPL.

Origin

Robert Blumofe and Charles Leiserson, "Scheduling Multithreaded Computations by Work Stealing," 1994. The default scheduling strategy for Cilk, Java ForkJoinPool (2011), Go (2012), Rust Rayon, .NET TPL.

Where it shows up in production
  • Go runtime Each P has a local run queue. Idle Ps steal from busy ones; the global queue catches overflow.
  • Java ForkJoinPool Default executor for parallel streams, CompletableFuture.
  • Rust Rayon, Tokio Both use work-stealing schedulers for their thread pools.
On Semicolony
Sources & further reading
Found this useful?