Learn the vocabulary of an idle worker stealing a task from a busier worker's queue instead of sitting idle.
0 / 5 completed
1 / 5
At standup, a dev mentions that each worker thread keeps its own queue of tasks, and whenever a worker's own queue runs empty, it steals a task from the back of another, busier worker's queue instead of sitting idle. What is this scheduling technique called?
A work-stealing scheduler is exactly this: each worker thread maintains its own queue of tasks, and whenever a worker runs out of tasks in its own queue, it steals a task from the back of another, busier worker's queue instead of remaining idle. A hash collision is an unrelated hash-table concept about two keys sharing a bucket. This steal-when-idle behavior is exactly why a work-stealing scheduler keeps all worker threads productively busy even when the initial task distribution across workers turns out uneven.
2 / 5
During a design review, the team relies on a work-stealing scheduler specifically because the number of tasks generated per worker varies unpredictably, and some workers would otherwise sit idle while others fall behind. Which capability does this provide?
A work-stealing scheduler here provides automatic load balancing across workers, since an idle worker steals tasks from a busier one instead of leaving that imbalance in place, which keeps every worker productively busy even when the number of tasks generated per worker varies unpredictably at runtime. A fixed, unchanging assignment of tasks to workers would leave some workers idle and others overloaded whenever that initial assignment turns out uneven, with nothing correcting it afterward. This automatic, on-demand rebalancing is exactly why work-stealing schedulers are common in parallel task-processing runtimes.
3 / 5
In a code review, a dev notices a parallel task runtime assigns tasks to workers once at the start and never rebalances afterward, so a worker whose tasks all finish quickly sits idle while another worker with heavier tasks falls behind. What does this represent?
This is a missed work-stealing opportunity, since a fixed, one-time task assignment leaves an idle worker with nothing to do while a busier worker falls behind, when letting the idle worker steal tasks from the busier one's queue would rebalance the load automatically and keep every worker productive. A cache eviction policy is an unrelated concept about discarded cache entries. This assign-once-and-never-rebalance pattern is exactly the kind of avoidable idle time a reviewer flags once task durations turn out to vary unpredictably across workers.
4 / 5
An incident report shows a parallel data-processing job's total runtime was far longer than expected, because tasks were assigned to workers once at the start with no rebalancing, leaving some workers idle for long stretches while others remained overloaded. What practice would prevent this?
Adopting a work-stealing scheduler lets an idle worker automatically steal tasks from a busier worker's queue, which directly eliminates the long idle stretches described in this incident by keeping every worker productively busy. Continuing to assign tasks once at the start with no rebalancing regardless of how uneven the load turns out is exactly what let some workers idle while others stayed overloaded. This work-stealing approach is the standard fix once task durations are known to vary unpredictably enough that a fixed, one-time assignment can't reliably balance load.
5 / 5
During a PR review, a teammate asks why the team's work-stealing scheduler steals from the back of a busier worker's queue rather than the front, given that either end holds a task waiting to be run. What is the reasoning?
A worker typically processes its own queue from the front, so stealing from the back grabs a task that worker is less likely to touch imminently, which minimizes contention and the need for careful synchronization between the worker actively pulling from the front and a thief reaching in from the back. Stealing from the front instead would frequently collide with the owning worker's own next pick, requiring more careful coordination to avoid conflicts. This front-versus-back split is exactly why many work-stealing schedulers are designed around this asymmetry to keep stealing cheap and low-contention.