liveBook · Manning

Reactor

As explained in Rust Servers, Services, and Apps

A reactor is an asynchronous-runtime component that observes operating-system I/O events and communicates readiness to the runtime.

A reactor is the Tokio runtime component that listens for operating-system I/O events and communicates readiness to the rest of the runtime. It connects kernel mechanisms such as epoll with futures, Wakers, and the executor. section 10.4

A file-reading task follows this path:

  • The kernel handles the file operation while the runtime schedules another asynchronous task. section 10.4
  • When the operation completes, the reactor recognizes the resulting operating-system event and marks the task's data as ready. section 10.4
  • The task's Waker informs the executor, which schedules the task and calls its future's poll function. section 10.4
Figure 10.10 Tokio components

Use the Tokio component diagram to trace relationships among the reactor, executor, Waker, futures, kernel, and asynchronous tasks. section 10.4

How Rust Servers, Services, and Apps covers it

How deep it goes
Explains an epoll-based file-I/O flow through readiness, waking, and polling without detailing reactor implementation internals.
Examples
Uses concurrent file-reading tasks to trace kernel events, readiness notification, waking, and executor polling.
What it assumes
Assumes futures and asynchronous tasks while defining executor, Waker, and reactor roles in their runtime flow.
What you can do after
Evaluate/understand how Tokio routes completed operating-system I/O through a reactor to future polling.
How it connects
Connects operating-system interrupts, epoll, futures, Waker, executor, and asynchronous tasks.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust Servers, Services, and Apps. The section links point to the parts of the book it draws on.