BEAM Processes vs. OS Threads: Exact Memory Footprint

A BEAM process typically starts at 2-3 KB, including its heap and stack, allowing for extreme efficiency. In contrast, an OS thread often requires 1-8 MB, primarily for its default stack size and kernel-level control blocks.

The top 3

  1. BEAM Processes vs. OS Threads: Memory Footprint Gap: A BEAM process typically starts with a memory footprint of approximately 2-3 KB, whereas a common OS thread, such as those in a JVM, often requires 1-2 MB for its stack, demonstrating a difference of hundreds to thousands of times.
  2. Scaling Concurrency: Millions of BEAM Processes vs. Thousands of OS Threads: The minimal memory footprint of BEAM processes enables the Erlang Virtual Machine to efficiently support millions of concurrent processes on a single machine, a scale that is practically unachievable with the significantly heavier OS threads.
  3. 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.

Sources

Open the full topic