BEAM Processes: Hundreds of Bytes vs. OS Threads: Megabytes
A typical BEAM process can start with a memory footprint as low as ~270 bytes, whereas an operating system thread usually requires several megabytes, primarily for its stack and execution context.
The top 3
- 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.
- Million-Process Density: BEAM's Memory Efficiency: The significantly smaller memory footprint of BEAM processes enables a single server to host millions of concurrent processes with only a few gigabytes of RAM. In stark contrast, 1 million OS threads could theoretically consume terabytes of memory, making such high concurrency infeasible.
- BEAM vs. OS Threads: Specific Memory Costs: BEAM processes typically start at a few hundred bytes (e.g., ~2-3 KB for a minimal process including control block, stack, and heap), while OS threads often require several megabytes (e.g., 1-8 MB) for stack space and thread control blocks.
Sources
Open the full topic