liveBook · Manning

Work stealing

Work stealing is a dynamic scheduling strategy that redistributes pending tasks to idle workers to balance workloads and improve utilization.

How 5 Manning books explain it

Clojure: The Essential Reference

Work-stealing is a parallel scheduling technique in which an idle worker takes unprocessed tasks from another worker's queue.

How it is used
Keeps workers occupied during parallel folds when chunks take unpredictable amounts of time.
How deep it goes
Explains chunk splitting and idle-worker stealing, but does not detail the underlying scheduling algorithm.
Examples
Uses a million-element fold sum and a benchmark where folding 1,000 elements is slower than reducing them.
What you can do after
Evaluate/understand when work stealing can help a fold and why a small fold may still be slower.

Read how Clojure: The Essential Reference explains work stealing →

Learn Concurrent Programming with Go

Work stealing is a scheduling technique in which an execution worker takes tasks from another worker's queue to improve utilization.

How it is used
Balances goroutine execution across kernel-level threads when blocking or uneven queue loads would otherwise leave processors idle.
How deep it goes
Explains queue migration and replacement threads, but stops short of runtime implementation details or stealing policies.
Examples
Uses local run queues, I/O blocking, replacement thread creation, and an empty queue stealing from a busy queue.
What you can do after
Evaluate how Go maintains goroutine progress and processor utilization during blocking operations and uneven workloads.

Read how Learn Concurrent Programming with Go explains work stealing →

Learn Haskell by Example

Work stealing is a scheduling technique in which an idle execution worker takes available work from a shared pool.

How it is used
Schedules sparks across Haskell execution contexts during parallel evaluation.
How deep it goes
Explains spark pools, execution contexts, and failure states, while deferring scheduling internals to the runtime.
Examples
Uses parallel list mapping, pixel-vector processing, chunked execution, and runtime spark statistics.
What you can do after
Apply it via Control.Parallel.Strategies to parallelize list or vector computations and inspect spark behavior.

Read how Learn Haskell by Example explains work stealing →

C++ Concurrency in Action, Second Edition

Work stealing is a scheduling technique in which an idle worker takes tasks from another worker’s queue.

How it is used
Balances uneven task distribution in a thread pool while reducing the synchronization overhead of shared work queues.
How deep it goes
Implements stealing with a mutex-protected deque and opposite-end access, while leaving lock-free queue design beyond scope.
Examples
Uses Quicksort to illustrate how recursive tasks can accumulate unevenly on one worker’s local queue.
What you can do after
Apply work stealing by giving workers local queues and allowing idle workers to take tasks from another queue.

Read how C++ Concurrency in Action, Second Edition explains work stealing →

100 Go Mistakes and How to Avoid Them

Work stealing is a scheduling technique in which an underutilized processor obtains runnable tasks from another processor's queue.

How it is used
Keeps processors productive by redistributing runnable goroutines when local and global queues do not provide work.
How deep it goes
Explains queue-search pseudocode and scheduling context, but stops short of runtime implementation details.
Examples
Uses a four-core scheduling state and runtime.schedule pseudocode to illustrate queue checks and stealing.
What you can do after
Evaluate/understand how Go redistributes runnable goroutines and distinguishes stealing from preemptive context switching.

Read how 100 Go Mistakes and How to Avoid Them explains work stealing →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.