liveBook · Manning

Sequenced-before relation

The sequenced-before relation is an ordering relation between evaluations within a single thread, as determined by the programming language’s execution rules.

How 2 Manning books explain it

C++ Concurrency in Action, Second Edition

A C++ ordering relation between evaluations within a single thread.

How it is used
Uses single-thread evaluation order to establish happens-before guarantees across threads through synchronization.
How deep it goes
Explains statement and expression ordering, then traces its composition with synchronization and acquire-release operations.
Examples
Uses function arguments with unspecified evaluation order and a spinlock protecting shared data.
What you can do after
Evaluate when operations are ordered within a thread and how that order carries across a synchronization boundary.

Read how C++ Concurrency in Action, Second Edition explains sequenced-before relation →

Modern C

The sequenced-before relation orders evaluations within a thread according to the C program's execution rules.

How it is used
Orders evaluations within one thread when reasoning about execution, correctness, and the consistency of observations.
How deep it goes
Defines the relation through a happened-before rule and a switch example, but defers cross-thread ordering to synchronization.
Examples
Uses a command[0] assignment before a switch and nested calls below ungetc to show an updated value being observed.
What you can do after
Evaluate within-thread ordering and determine when a later statement observes an earlier assignment.

Read how Modern C explains sequenced-before relation →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.