PON-BEAM is a complete re-architecture of the Erlang/OTP 30 Virtual Machine (ERTS — Erlang Run-Time System) using the Notification-Oriented Paradigm (PON) created by Prof. Dr. Jean Marcelo Simão.
By replacing conventional, safe-yet-costly linear scanning and periodic polling loops across internal VM subsystems with a reactive mesh of event-driven notification callbacks, PON-BEAM eliminates CPU idle waste (
🏛 Architecture & Paradigm Inversion
Traditional Virtual Machines rely heavily on continuous polling loops (e.g., scheduler sleeping checks, timer wheel ticks) and linear buffer scans (e.g., mailbox selective receive scanning and garbage collection heap marking).
PON-BEAM fundamentally inverts this control flow: Entities register Premises and Conditions, and state changes push point-to-point Instigation notifications directly to waiting consumers.
flowchart LR
subgraph Traditional ["Stock BEAM (OTP 30) - Polling and Linear Scan"]
direction TB
P_Scan["Selective Receive: Linear Scan Mailbox O(N)"]
T_Poll["Timer Wheel: Periodic Polling Ticks"]
S_Spin["Scheduler: Idle Busy-Spin Loop (5-30 CPU)"]
end
subgraph PON_BEAM ["PON-BEAM - Reactive Push Graphs"]
direction TB
Cond["PON Condition (State Change / Message Arrival)"]
Premise["PON Premise (Pattern Match Slot)"]
Instig["PON Instigation (Direct O(1) Execution Jump)"]
Cond -->|Pushes Event| Premise
Premise -->|Satisfies| Instig
end
Traditional ==>|Re-Architected As| PON_BEAM
EventFD & Epoll Scheduler Wakeup
sequenceDiagram
autonumber
participant Producer as Message Producer (Process A)
participant PON as PON Mailbox Mesh
participant EFD as eventfd / epoll Kernel
participant Sched as Idle Scheduler (0.0% CPU)
Note over Sched: Scheduler in Sleep State (0% CPU Waste)
Producer->>PON: Send Message matching registered Premise
PON->>EFD: Write notification to eventfd accumulator
EFD-->>Sched: epoll_wait unblocks instantly (< 1µs)
Sched->>Sched: Execute process (Instigation triggered)
⚡ Subsystem Breakdown & Asymptotic Gains
Every internal ERTS subsystem was redesigned as a reactive PON entity:
| Phase | Subsystem | Metric | Stock BEAM (OTP 30) | PON-BEAM | Asymptotic Gain | Performance Speedup |
|---|---|---|---|---|---|---|
| Phase 1 | PON-Receive | Selective receive latency ( |
||||
| Phase 2 | PON-Timer | Idle CPU (0 active timers) | Polling |
|||
| Phase 2 | PON-Timer | Checks/sec ( |
Polling |
|||
| Phase 3 | PON-Spawn | Process creation latency | Scan |
|||
| Phase 4 | PON-Scheduler | Idle CPU ( |
Spin eventfd
|
|||
| Phase 4 | PON-Scheduler | Reactivation latency | Timeout epoll
|
|||
| Phase 5 | PON-ETS |
|
Search |
|||
| Phase 6 | PON-Compiler | Receive opcode compilation | Beam SSA Match | Premise SSA | SSA |
Native |
| Phase 7 | PON-GC | Heap scan ( |
|
📈 Benchmark Results: Charts & Analysis
The charts below are generated by harness/report/generate_charts.py from the differential measurements collected by make benchmark. In every figure the Stock OTP 30 baseline appears in red and PON-BEAM in green.
Phase 1 — PON-Receive: Mailbox Selective Receive ($O(N \times M) \to O(1)$)
What the chart shows — As the pending mailbox grows from 100 to 50,000 messages, the Stock BEAM linear-scan cost climbs from 12 µs to 6,400 µs (a single receive must trial-match every clause against every queued message). PON-BEAM stays flat at ~15–16 µs across the entire range because processes register their Premises and only matching messages push an Instigation to the save-pointer. The gap widens monotonically with N, confirming the asymptotic inversion rather than a constant-factor optimization.
Phase 2 — PON-Timer: Timer Wheel vs Kernel timerfd
What the chart shows — With 0→50,000 concurrent timers, the Stock timer-wheel polling cost burns up to 139 ms of CPU time and grows with the timer count. PON-BEAM hands expiration to the Linux kernel (timerfd) and stays flat (~120–126 ms) regardless of how many timers are registered — the VM is only woken up on the single next due event, never to sweep the wheel.
Phase 3 — PON-Spawn: Process Creation Under a 50,000-Actor Storm
What the chart shows — A storm of 50,000 process creations shows Stock BEAM latency peaking at 86 µs. PON-BEAM's O(1) direct-notify path caps the distribution at 69 µs (−19.7%) and eliminates the long jitter tail, producing a tighter, more predictable latency histogram.
Phase 4 — PON-Scheduler: Idle CPU Waste (eventfd/epoll)
What the chart shows — With zero active work, the Stock scheduler busy-spins and wastes between 15 and 25% of a core over 60 seconds of idle. PON-BEAM reports exactly 0.0%: instead of spinning, the scheduler parks on an eventfd and is unblocked by the kernel epoll wakeup path instantaneously when a notification arrives.
Phase 5 — PON-ETS: Throughput Under Hot-Key Contention
What the chart shows — Under contended access to a hot key, the Stock lock-contention path delivers 1.70 M ops/s combined (1.25 M parallel reads + 0.45 M updates). PON-BEAM's watcher side-table delivers 11.96 M ops/s (9.97 M reads + 1.99 M writes) — a ~7× combined throughput gain — because notifications bypass the search and the lock.
Phase 7 — PON-GC: Latency Distribution on 90% Dead-Object Heap
What the chart shows — On a heap where 90% of objects are garbage, the Stock full-heap scan centers around 645 ms, with outliers reaching 940 ms. PON-BEAM's live-object tri-color mark averages 475 ms (−26.3%) and significantly shortens the P99 tail, making GC pauses more bounded and predictable.
Holistic View — No Trade-offs
What the chart shows — Scaling five representative axes (idle CPU efficiency, mailbox speed, ETS throughput, GC speed, spawn latency) to a 0–10 scale, PON-BEAM dominates on all axes simultaneously. The re-architecture improves every subsystem without regressing any other — unlike classic optimizations that trade throughput for latency or memory.
Reproducibility — Regenerate all charts at
docs/assets/charts/withpython3 harness/report/generate_charts.py, or run the full differential measurement suite withmake benchmarkfollowed bymake reportto open the latest comparative HTML report.
🛠 System Requirements
To build and run PON-BEAM, ensure your host environment satisfies:
-
Operating System: Linux (Kernel
$\ge 4.18$ , required foreventfd&timerfdreactivity). -
Compiler: GCC
$\ge 9.0$ or Clang$\ge 11.0$ (C99/C11 compliant). -
Build Tools:
make,autoconf($\ge 2.69$ ),m4,flex,bison. - Runtime Bootstrap: An existing Erlang/OTP installation (for bootstrap compilation).
-
Formal Tools (Optional): Java 11+ (for TLA+ TLC model checker), Coq
$\ge 8.13$ , Frama-C.
🚀 Building PON-BEAM
Clone the repository with submodules:
git clone https://github.com/matheuscamarques/pon_beam.git
cd pon_beam1. Build Both ERTS Targets
# Build Baseline Stock Erlang/OTP 30 (Installed to /opt/erlang-30-stock) make build-stock # Build PON-BEAM ERTS (Installed to /opt/erlang-30-pon) make build-pon # Build PON-BEAM with Debug Counters & Telemetry make build-pon-debug
2. Fast Incremental C Recompile
When iteratively hacking on C source files in otp/erts/emulator/beam/*.c:
# Recompiles only the PON ERTS C emulator binary (~1-3 minutes) make emulator-pon # Recompiles Stock ERTS C emulator binary make emulator-stock
📊 Benchmark Harness & Comparative Reports
PON-BEAM includes a comprehensive benchmark harness (harness/) comparing Stock OTP 30 against PON-BEAM under identical workloads.
# Run complete benchmark suite across all phases make benchmark # Run benchmark suite for a specific phase (e.g. Phase 1 PON-Receive) make benchmark-fase1 # List all available benchmark scenarios make benchmark-list # Open the latest interactive HTML differential report make report
🛡️ 4-Pillar Formal Verification Suite
To guarantee that replacing linear scanning with reactive callbacks preserves exact Erlang semantics while eliminating deadlocks and lost wakeups, PON-BEAM provides a formal verification pipeline across 4 mathematical pillars:
graph TD
P1["Pillar 1: Model Checking (TLA+/TLC)"] --> |Verifies| V1["Scheduler Wakeup and Mailbox Invariants"]
P2["Pillar 2: Theorem Proving (Coq)"] --> |Proves| V2["Tri-Color GC Safety and O(1) Asymptotic Bound"]
P3["Pillar 3: Static and Symbolic (Frama-C / KLEE)"] --> |Proves| V3["ACSL C Memory Safety and LLVM Path Coverage"]
P4["Pillar 4: Property Testing (PropEr)"] --> |Verifies| V4["Stateful Model Equivalence (Stock vs PON)"]
Run the verification suite via Makefile:
# Run entire formal verification suite (TLA+, PropEr, Frama-C) make verify-all # Pillar 1: TLA+ Model Checker (Scheduler & Mailbox Specs) make verify-tla # Pillar 4: Stateful Equivalence Property Tests (PropEr) make verify-proper # Pillar 3: Frama-C ACSL C Contract Analysis make verify-c
🐳 Docker Containerized Execution
Run the complete build and benchmark suite inside an isolated Docker container:
# Build Docker image containing Stock OTP 30 + PON-BEAM (~30 min) make docker-build # Run benchmarks in container and copy HTML reports to harness/results/docker/ make bench-docker
📁 Repository Structure
pon-beam/
├── otp/ # Fork of Erlang/OTP 30.0-rc0 (branch: pon-beam)
│ └── erts/emulator/beam/ # ERTS VM Core — Where PON modifications live
├── formal/ # 4-Pillar Formal Verification Suite
│ ├── tla/ # TLA+ specifications & TLC runner (SchedulerWakeup, MailboxPON, etc.)
│ ├── coq/ # Coq mechanized proofs (TriColorGC.v, PONComplexity.v)
│ ├── framac/ # Frama-C ACSL annotations (pon_acsl.h) & WP runner
│ ├── klee/ # KLEE LLVM symbolic execution harness
│ └── proper/ # PropEr stateful equivalence test suite
├── harness/ # Comparative benchmark harness
│ ├── config/ # ERTS paths (baseline.sh, ponbeam.sh)
│ ├── benchmarks/ # Erlang benchmark suites
│ └── report/ # HTML differential report generator
├── docs/ # Engineering specifications & thesis documentation
│ ├── STORYTELLING.md # Evolution saga of PON-BEAM
│ ├── PROJECT_PLAN.md # Master engineering plan & milestone roadmap
│ ├── COMPARISON.md # Baseline vs PON-BEAM comparative metrics
│ └── GRAPHS.md # Visual scalability charts & diagrams
├── Makefile # Primary build, benchmark, and verification entry point
└── AGENTS.md # Agentic workflow guidelines & project golden rules
📚 Documentation & References
- 📖 PON-BEAM Evolution Storytelling (Full Saga)
- 📋 Master Engineering Plan & Phase Roadmap
- 📊 Comparative Performance Tables
- 📈 Scalability Graphs & Visual Charts
- 🎓 Foundational Reference: Notification-Oriented Paradigm (PON) — Simão & Stadzisz (2008–2009).
📄 License
Licensed under the Apache License 2.0 (the same license as Erlang/OTP).






