liveBook · Manning

Synchronous call

As explained in Grokking Concurrency

A synchronous call is an I/O call that retains control until the operation completes and thereby creates a synchronization point.

Waiting for an answer

Imagine asking a question on a phone call and waiting for the other person to answer before doing anything else. The answer marks the point where you can continue. A text message works differently: you can send it, do something else, and read the reply later. section 11.7

A synchronous call keeps control until an I/O operation completes. It does not return early, so the next step must wait. That completion becomes a synchronization point: work that depends on the result can proceed afterward. section 11.8 section 11.7

Synchronous and blocking describe related but distinct ideas. Synchronous describes the application’s flow of control during I/O; blocking describes how an application asks the operating system to access a device. A blocking I/O operation also waits to return until it completes, but the terms describe different levels. section 11.8

The practical question is what happens while the caller waits:

  • If tasks must exchange data in order, a synchronous exchange makes that wait explicit. Pipes are one way to support synchronous communication between producer and consumer processes. section 11.7 section 5.6
  • If many long-running tasks can do other work, waiting for every exchange may leave resources idle. An asynchronous call returns immediately and makes its result available later; it is an alternative, not an automatic improvement for every application. section 12.2 section 13.11

How Grokking Concurrency covers it

How deep it goes
Defines the call’s completion behavior and distinguishes control flow from blocking mode, without detailing an implementation.
Examples
Contrasts a phone conversation with texting and identifies pipes as a synchronous producer–consumer communication mechanism.
What it assumes
Introduces blocking and nonblocking I/O alongside synchronous and asynchronous calls rather than assuming those distinctions are known.
What you can do after
Evaluate/understand when waiting for communication prevents tasks from doing other useful work.
How it connects
Connects synchronous calls to blocking I/O, asynchronous calls, message passing, and interprocess communication.

Also explained in

Compare how 6 books explain synchronous call →

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.