Why BEAM Processes Are So Lean: VM-Managed Efficiency

BEAM processes achieve their lightweight nature because they are created and managed within the Erlang VM, utilize dynamically allocated small stacks that grow as needed, and bypass the higher OS overhead associated with separate virtual memory spaces and complex synchronization of shared memory.

The top 3

  1. Per-Process Heaps: BEAM's GC Efficiency: Each BEAM process manages its own independent heap, allowing for highly efficient, generational garbage collection that minimizes memory use and avoids global system pauses.
  2. Message Passing: Lean Process Interaction: BEAM processes communicate exclusively through immutable message passing, eliminating shared memory complexities, locks, and the associated memory overhead of OS thread synchronization.
  3. User-Space Scheduler: Tiny Process Context: The BEAM VM schedules processes entirely in user-space, bypassing OS kernel overhead and enabling extremely small, dedicated execution contexts and stack sizes for each process.

Sources

Open the full topic