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:
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.