Erlang / Erlang Basics Interview questions
Explain the internal working of the BEAM scheduler?
The BEAM typically runs one scheduler thread per CPU core, and each scheduler maintains its own run queue of processes ready to execute. Rather than relying on OS-level time slicing, the BEAM preempts processes based on a reduction count — roughly one reduction per function call/operation — giving each process a budget (around 2000 reductions) before it's paused and put back at the end of the run queue.
flowchart LR
A[Run queue: Process A, B, C] --> B[Scheduler picks Process A]
B --> C{Reduction budget exhausted or process waits?}
C -->|Yes| D[Process A suspended, requeued]
C -->|No, finished naturally| E[Process A removed from queue]
D --> A
This makes scheduling fair and predictable regardless of what an individual process does — a process stuck in a tight loop can't starve others, since it gets preempted at the reduction boundary just like everyone else. Schedulers also periodically rebalance work across cores via work stealing, so a scheduler that runs out of ready processes can pull some from a busier neighbor's queue instead of sitting idle.
Invest now in Acorns!!! 🚀
Join Acorns and get your $5 bonus!
Acorns is a micro-investing app that automatically invests your "spare change" from daily purchases into diversified, expert-built portfolios of ETFs. It is designed for beginners, allowing you to start investing with as little as $5. The service automates saving and investing. Disclosure: I may receive a referral bonus.
Invest now!!! Get Free equity stock (US, UK only)!
Use Robinhood app to invest in stocks. It is safe and secure. Use the Referral link to claim your free stock when you sign up!.
The Robinhood app makes it easy to trade stocks, crypto and more.
Webull! Receive free stock by signing up using the link: Webull signup.
More Related questions...
