liveBook · Manning

Blocking

As explained in Grokking Concurrency

Blocking is a condition in which a task or operation cannot make progress until a required event, resource, or I/O operation completes.

Waiting for a pizza to cook can leave you stuck in a chair, unable to do anything else. In computing, an operation is blocking when it cannot return or make progress until an I/O operation or other required event completes. While waiting for I/O, the application may leave the processor idle. section 10.8 section 10.9

Blocking has different consequences depending on where it happens:

  • A blocking socket call such as recv() waits until data arrives; a web server that spends much of its time waiting for clients can use the CPU inefficiently. section 10.9
  • Blocking and synchronous are related but distinct: blocking describes whether an I/O call returns before completion, while synchronous describes the flow of control. section 11.8
  • A blocked thread can leave other ready tasks available to run, but blocking the main thread of an event loop can stop the whole system from responding. section 10.10 section 12.1

How Grokking Concurrency covers it

How deep it goes
Defines blocking I/O and distinguishes it from synchronous control flow, without detailing all four I/O models.
Examples
Uses waiting for pizza to cook and socket calls such as send() and recv() as examples.
What you can do after
Understand why blocking I/O can leave a processor idle or make an event loop unresponsive.
How it connects
Connects blocking to I/O, concurrency, threads, event loops, and asynchronous programming.

Also explained in

Compare how 9 books explain blocking →

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.