liveBook · Manning

Preemption

As explained in Elixir in Action, Third Edition

Preemptive scheduling is a scheduling method that interrupts running processes to switch execution to other runnable processes.

Preemption gives each runnable Erlang process a small execution window, then pauses it so a scheduler can run another process. Frequent context switches prevent one long-running process from blocking the rest of the system and favor predictable responsiveness. section 1.1.2 section 1.3.1

In a BEAM system, preemption supports several production behaviors:

  • Long-running processes cannot significantly block other processes. section 1.1.2
  • As load rises, requests may take longer, but the system can degrade gracefully instead of becoming paralyzed. section 1.3.1
  • Preemption improves responsiveness but does not make intensive CPU computation as performant as equivalent C or C++ code. section 1.3.1
Figure 1.1 Concurrency in the Erlang virtual machine
CH01_F01_Juric3

Use the virtual-machine diagram to connect schedulers, concurrent processes, and system responsiveness. section 1.1.2

How Elixir in Action, Third Edition covers it

How deep it goes
Explains execution windows, pauses, context switches, and load behavior without detailing scheduler implementation internals.
Examples
Illustrates long-running processes, waiting I/O operations, rising request load, and the Erlang virtual machine.
What you can do after
Evaluate/understand how BEAM scheduling limits blocking and shapes performance under increasing load.
How it connects
Connects concurrency with schedulers, responsiveness, fault tolerance, distribution, I/O operations, and graceful degradation.

Also explained in

Compare how 5 books explain preemption →

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.