Unit content
Work-stealing schedulers
A work-stealing scheduler dynamically balances task-parallel work without routing every task through one central queue.
Each worker maintains a local deque of ready tasks. It normally pushes and removes its own work from one end, preserving locality and keeping uncontended operations cheap.
When a worker runs out of work, it becomes a thief and takes a task from another worker's deque, commonly from the opposite end.
This structure works especially well for nested fork-join computations. A worker can continue down one recursive branch while leaving other ready branches available to be stolen by idle processors.
Stealing is relatively rare when load is balanced, so most scheduling remains local. When imbalance appears, idle processors actively redistribute work.
Work stealing does not create parallelism that the dependency graph lacks. It helps map existing ready work to processors while balancing scheduling overhead and locality.
Execution order becomes nondeterministic, so correctness must not depend on which ready task happens to run first.