User-Space M:N Scheduler with Work-Stealing Power

The BEAM employs an M:N scheduling model in user space, mapping millions of lightweight Erlang processes (M) onto fewer OS threads (N, typically one per core), with schedulers actively 'stealing' work from busy queues to optimize multi-core utilization.

The top 3

  1. Origins of Work-Stealing: From Multilisp to Cilk's Parallelism: The work-stealing scheduling strategy traces its roots to the 1980s with the Multilisp programming language and parallel functional programming research, later famously refined and employed by the Cilk programming language to efficiently manage dynamic multithreaded computations.
  2. M:N Work-Stealing's Top 3 Performance Advantages: This scheduling model excels by drastically reducing memory usage with lightweight user-space tasks (e.g., Go's 2KB goroutine stacks vs. 1MB OS threads), minimizing context-switching overhead (around 200 nanoseconds vs. OS-level), and ensuring superior load balancing through active work redistribution.
  3. Leading Runtimes Embracing Work-Stealing Schedulers: Prominent high-performance runtimes like Go (with its G-M-P model since Go 1.1), Java's Project Loom (Virtual Threads in Java 21 using ForkJoinPool), and the Rust Tokio runtime all effectively leverage work-stealing M:N schedulers for scalable and efficient concurrency.

Sources

Open the full topic