AlgoMaster Logo

Event Loops, Reactor, and Proactor

High Priority15 min readUpdated August 14, 2026

Knowing which sockets are ready or which I/O operations have completed is only part of the job. The server still needs to decide what code should run next.

It must map each event to the right connection, invoke the correct handler, preserve unfinished state, process timers, and return control before one handler blocks the entire loop.

An event loop provides this structure. It waits for events, dispatches them to handlers, and repeats.

Two common models define what those events mean:

  • Reactor: an event says an I/O operation is ready to be performed.
  • Proactor: an event says an asynchronous I/O operation has completed.

Both can handle many concurrent connections with few threads. The key difference is who performs the I/O and when.

This chapter compares Reactor, Proactor, and hybrid event-loop architectures, then examines connection state, timers, slow handlers, blocking work, fairness, work budgets, and event-loop stall detection.

Premium Content

Subscribe to unlock full access to this content and more premium articles.