liveBook · Manning

I/O-bound work

As explained in Grokking Concurrency

An I/O-bound operation is an operation whose completion primarily depends on input/output activity or waiting for external hardware or services.

Imagine asking a computer to read a large file. While the disk supplies the next piece of data, the processor may have little to calculate. Work is I/O-bound when faster input or output would make it finish sooner. The bottleneck is the device or service it is waiting for, not the speed of the processor. section 6.3

Waiting can take several forms:

  • A search through a huge file can be limited by how quickly the disk supplies its contents. section 6.3
  • A web server or database may spend much of its time on network or disk I/O. section 6.3
  • A graphical application may wait for a person to use the keyboard or mouse, even when it never opens a file. section 6.3

The distinction matters when choosing a performance improvement. Multiplying enormous matrices is CPU-bound: computation is the limiting work. Copying a large stream from a network to a disk can instead leave cores waiting for data transfer. Adding processor cores alone will not remove that I/O bottleneck. section 6.4

Keeping an arcade game responsive

Picture a one-core arcade game with three jobs: get_user_input() waits for the controller, compute_game_world() calculates what happens next, and render_next_screen() sends the result to the display. Input and rendering are I/O-bound; world computation is CPU-bound. When the player has not pressed a button, the processor can work on another ready task instead of spending that time waiting. section 6.5 section 6.8

An operating system can park a task blocked on I/O, run a ready task, and make the parked task ready again when I/O completes. This is why multitasking can help I/O-heavy workloads even on one core: it uses otherwise idle processor time, rather than making the device faster. Switching tasks has a cost, however; creating more tasks is not automatically an improvement. section 10.10 section 6.14

How Grokking Concurrency covers it

How deep it goes
Defines the bottleneck, illustrates waiting with workloads, and follows blocked tasks through scheduling without detailing device internals.
Examples
Uses file searching, network-to-disk transfer, graphical input, and a one-core arcade game to contrast waiting with computation.
What it assumes
Introduces processor work and device waiting before applying multitasking; assumes no prior concurrency terminology.
What you can do after
Diagnose/debug with it by identifying whether I/O waiting, rather than processor speed, limits a workload.
How it connects
Connects I/O-bound work to CPU-bound work, multitasking, context switching, and blocked and ready task states.

Also explained in

Compare how 5 books explain I/O-bound work →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Concurrency. The section links point to the parts of the book it draws on.