liveBook · Manning

Non-blocking I/O

As explained in Rust in Action: Systems programming concepts and techniques

Non-blocking I/O allows a thread to continue executing while it waits for input or output data.

Non-blocking I/O lets a thread continue executing while it waits for input or output data. Instead of becoming blocked on one device, it can handle other work while the operating system gathers results. section 10.5

Operating systems can batch data from multiple sockets into queues and poll those queues periodically. Asynchronous programming supplies the control flow for responding when devices or other threads signal that work is ready. section 10.5

Non-blocking I/O changes the trade-offs of I/O-heavy programs:

  • Avoids waiting for one I/O request to finish before continuing. section 10.5
  • Can improve runtime by reducing system calls and user-space/kernel-space context switches. section 10.5
  • Requires more complicated control flow because external I/O events affect execution order. section 10.5

How Rust in Action: Systems programming concepts and techniques covers it

How deep it goes
Defines blocking behavior, queued polling, asynchronous control flow, and performance rationale without detailing APIs or implementation code.
Examples
Uses multiple sockets, batched queues, periodic polling, device-driver signals, and functions returning in another thread.
What you can do after
Understand it as a way to keep threads productive during I/O waits and evaluate its complexity and runtime trade-offs.
How it connects
Connects non-blocking I/O to asynchronous programming, concurrency, parallelism, coroutines, threads, sockets, and context switching.

Also explained in

Compare how 5 books explain non-blocking I/O →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Rust in Action: Systems programming concepts and techniques. The section links point to the parts of the book it draws on.