Process Starvation Guard: Reductions Ensure Fair CPU Access
Erlang's reduction-based scheduling prevents any single process from indefinitely monopolizing the CPU, ensuring fair access and mitigating process starvation even among millions of concurrent lightweight processes.
The top 3
- Erlang's 'Reduction' Unit: The CPU Budget Explained: A 'reduction' is BEAM's fundamental work unit, roughly one function call, arithmetic operation, or message passing. Processes are preempted after exhausting a budget, typically 2000 reductions, ensuring fair CPU access and preventing starvation.
- Reductions vs. Time-Slicing: Erlang's Fairness Edge: Unlike OS time-slicing, Erlang's reduction-based preemption offers superior fairness and portability by avoiding expensive OS calls, ensuring every process gets a proportional share of CPU time efficiently.
- Erlang's Preemptive Edge Over Go & Haskell Schedulers: Erlang's reduction-based scheduler ensures full preemption for all Erlang code, preventing CPU hogging, unlike Go or Haskell/GHC which are often partially preemptive, only yielding at specific points like function calls or allocations.
Open the full topic