▶ Interactive Lab

Work-Stealing Scheduler

Worker queues fill at different rates; idle workers steal from busy ones.

Advertisement
4 workers, each with own deque. When a worker's deque is empty, it steals from a random busy one.

What you're seeing

Each worker has its own task deque. Local push/pop is fast (no contention). When empty, steal from another worker's top. Lock-free Chase-Lev deque makes the steal cheap.

Used by Java's ForkJoinPool, Go's scheduler, Tokio's multi-thread runtime, Rust's Rayon. Scales to many cores by avoiding centralized contention.

★ KEY TAKEAWAY
Each worker has its own deque. When idle, steal from a busy worker's top. Scales to many cores without central contention.
▶ WHAT TO TRY
  • Click Start — watch tasks complete and workers steal from each other.
  • Yellow arrows = steal events.
  • This is how Java's ForkJoinPool, Go's scheduler, Tokio's runtime all work.