liveBook · Manning

Scheduler

As explained in Elixir in Action, Third Edition

A scheduler is a runtime component that selects runnable processes and allocates execution time to them.

A scheduler is the BEAM runtime component that manages concurrent Erlang processes. It assigns each process an execution time slot, then switches to another process when the slot ends. By distributing processes across schedulers and available CPU cores, BEAM supports highly concurrent server systems without relying on one OS thread per task. section 1.1.2 section 5.1

The scheduler’s production behavior follows several practical principles:

  • BEAM uses as many schedulers as available CPU cores by default; each scheduler runs in its own OS thread while the VM remains one OS process. section 5.1
  • Preemptive scheduling performs frequent context switches, favors short-running processes, and prevents long-running processes from significantly blocking the rest of the system. section 1.3.1
  • As demand exceeds available capacity, requests can take longer while the system continues operating; additional hardware can increase capacity. section 1.3.1
  • Schedulers make lightweight BEAM processes practical for parallel server tasks, while process isolation limits the effects of individual crashes. section 1.1.2 section 5.1

Quad-core execution

On a quad-core machine, BEAM uses four schedulers by default. Each scheduler runs in a separate OS thread and takes turns executing the VM’s much larger pool of lightweight processes. section 5.1

Figure 5.1 BEAM as a single OS process, using a few threads to schedule a large number of processes
CH05_F01_Juric3

The figure shows how one BEAM OS process and a small number of scheduler threads execute many concurrent processes. section 5.1

How Elixir in Action, Third Edition covers it

How deep it goes
Explains scheduler threads, time slots, preemption, core defaults, and graceful load behavior.
Examples
Uses a quad-core VM and architectural figures showing scheduler threads executing many lightweight processes.
What it assumes
Assumes familiarity with BEAM processes and concurrent execution, while contrasting VM-managed processes with OS threads.
What you can do after
Evaluate/understand how preemption and core-aware scheduling affect responsiveness and graceful degradation under load.
How it connects
Connects schedulers with BEAM processes, CPU cores, isolation, fault tolerance, scalability, and distribution.

Also explained in

Compare how 12 books explain scheduler →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Elixir in Action, Third Edition. The section links point to the parts of the book it draws on.