Top 3 Runtimes Harnessing Work-Stealing Power

Go's runtime has used a work-stealing scheduler since version 1.1 to efficiently distribute goroutines, while Erlang's BEAM (powering Elixir) employs it for load balancing across its lightweight processes, and Java's Fork/Join framework alongside .NET's Task Parallel Library also leverage work-stealing for optimal task execution.

The top 3

  1. Java's ForkJoinPool: Parallel Streams' Work-Stealing Engine: Java's ForkJoinPool introduced the work-stealing algorithm, enabling efficient parallel processing for features like parallel streams and CompletableFutures. It utilizes double-ended queues (deques) where idle worker threads can 'steal' tasks from the tail of busy threads' queues, maximizing CPU utilization.
  2. Go's Scheduler: Goroutine Work-Stealing for Scalability: The Go runtime scheduler has leveraged a work-stealing algorithm since Go 1.1 to efficiently distribute goroutines across multiple OS threads. Each thread maintains a local run queue, and when idle, it attempts to 'steal' half of the goroutines from a randomly chosen busy thread's local queue, crucial for scaling Go programs on multi-core systems.
  3. Rust's Tokio: Async Runtime's Work-Stealing for High Performance: The Tokio runtime in Rust leverages a multi-threaded work-stealing scheduler, where each worker thread has its own task queue, and idle workers can 'steal' tasks from others to balance load and achieve high throughput for millions of asynchronous tasks.

Sources

Open the full topic