BEAM's Preemption Edge: Top 3 Scheduling Models

The BEAM VM's user-space, reduction-count-based preemption stands out by ensuring all processes get fair CPU time, contrasting with OS-level time-slicing and cooperative models, which is crucial for millions of concurrent AI agents needing predictable responsiveness.

The top 3

  1. Reduction-Based Preemption: Fairer Than Time-Slicing: BEAM's scheduler preempts processes based on 'reduction counts' – units of work performed – rather than fixed time slices, ensuring no single process hogs the CPU and providing predictable fairness for millions of lightweight processes.
  2. 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.
  3. Shared-Nothing Processes: Enabling Reliable Preemption & Fault Tolerance: BEAM's lightweight processes operate with isolated memory, communicating solely via message passing. This 'shared-nothing' model eliminates data races, simplifying preemption and guaranteeing clean process termination and fault recovery, a significant advantage for system stability.

Sources

Open the full topic