Developed at Ericsson in the late 1980s by Joe Armstrong, Robert Virding, and Mike Williams to power telecommunications switches, Erlang was engineered with a radical design requirement: systems must achieve "Nine Nines" (99.9999999\%) availability, operating continuously through hardware faults, network partitions, and software bugs without downtime.
This guide provides deep technical coverage of the BEAM Virtual Machine, the Share-Nothing Actor Model, OTP (Open Telecom Platform) Generic Behaviors, and Supervision Tree Hierarchies.
+-----------------------------------------------------------------------------------------------------------------------+
| CONCURRENCY RUNTIME COMPARISON |
+-----------------------------------------------------------------------------------------------------------------------+
| Runtime Feature | Erlang BEAM Process | Java Virtual Thread (Loom) | OS Native Thread (Pthread)|
+------------------------+----------------------------------------+----------------------------+------------------------+
| Memory Footprint | ~ 300 Bytes per process | ~ 1 KB | ~ 1 MB - 8 MB |
| Concurrency Scale | Millions of concurrent processes | Millions of virtual threads| Thousands per server |
| Memory Model | Share-Nothing (Isolated per-proc heap) | Shared Heap | Shared Memory |
| GC Pauses | Per-process (Zero global STW pauses) | Global STW pauses (G1/ZGC) | Manual / None |
| Preemption Invariant | Reduction counting (Fair preemption) | Cooperative at blocking IO | OS Kernel Time-slice |
| Fault Containment | Process crash isolated; supervisors heal| Uncaught uncaught crashes JVM| Segfault terminates app|
+-----------------------------------------------------------------------------------------------------------------------+
Unlike operating systems where processes share memory through complex locking, every BEAM process is an isolated actor with its own:
BEAM VM Multi-Core Scheduler Pool
+-------------------------------+
| Scheduler Core 1 | Core 2 |
+---------+---------+-----+-----+
| |
v v
[ Process A ] [ Process B ]
(Heap: 4 KB) (Heap: 12 KB)
(Mailbox: [M1, M2]) (Mailbox: [])
| ^
| Send Message (!): |
+---------------------+
(Deep copied across heaps,
or zero-copy Refc Binary >64B)
In Erlang philosophy, attempting to defensively anticipate every conceivable edge case via nested try/catch handlers leads to fragile, bloated code. Instead, Erlang embraces "Let It Crash": processes fail fast, while structured Supervisors automatically restart them in clean, known-good states.
[ Root Supervisor ]
|
+---------------+---------------+
| |
v v
[ Worker Supervisor ] [ DB Connection Pool ]
|
+--------+--------+
| |
v v
[ Worker 1 ] [ Worker 2 ]
(Crashes!) (Healed by one_for_one strategy)
one_for_one: If a child process crashes, only that child is restarted.one_for_all: If any child crashes, all sibling processes in the supervisor group are terminated and restarted (essential for tightly coupled state machines).rest_for_one: If a child crashes, only subsequent siblings defined after it in the startup order are restarted.