recall

← recall

work stealing pattern

Each worker has its own task queue. When a worker runs out of work, it steals from another worker's queue (usually the back, while owners take from the front). Self-balancing under uneven loads without central coordination. Powers Go's runtime, Java's ForkJoinPool, Rust's Tokio.

Each worker has its own task queue. When a worker runs out of work, it steals from another worker's queue (usually the back, while owners take from the front). Self-balancing under uneven loads without central coordination. Powers Go's runtime, Java's ForkJoinPool, Rust's Tokio.

symptoms

  • some workers idle while others overloaded
  • central queue contention
  • uneven task distribution

causes

  • single shared queue
  • static partitioning of work

fixes

  • per-worker queues + work stealing from idle workers
  • tune steal frequency vs cache locality

you might say

  • work-stealing scheduler
  • idle steals

related

topics: concurrency, performance

references: