BEAM's VM: The Secret to Micro-Sized Processes

BEAM processes are managed entirely by the Erlang Virtual Machine, not the operating system, eliminating heavy OS-level overheads by providing isolated, dynamically growing heaps and simplified context switching.

The top 3

  1. BEAM Process Memory: Kilobytes vs. Megabytes: Each BEAM process typically consumes only a few kilobytes of RAM, in stark contrast to operating system threads which often require several megabytes, enabling millions of concurrent processes on a single server.
  2. Faster Context Switching: BEAM's VM vs. OS Kernel: The BEAM VM handles context switching for its processes entirely in user space, avoiding expensive kernel-level transitions and resulting in context switches that are orders of magnitude faster than those of traditional OS threads.
  3. The BEAM Scheduler's Non-Preemptive Advantage: BEAM's scheduler employs a non-preemptive, work-stealing strategy, where processes voluntarily yield control after a fixed number of reductions (operations), ensuring fairness and preventing any single process from monopolizing the CPU.

Sources

Open the full topic