IT lexicon › Programming › Happens-before-order

Happens-before-order

Programming På svenska → Updated: 2026-11-16

A partial ordering between instructions and events that specifies when one operation is guaranteed to be visible to another.

Happens-before is the heart of modern memory models such as Java Memory Model and C++11. It defines which operations must be observable before others begin. Without this ordering, a compiler or CPU could reorder instructions in ways that make reasoning about concurrent programs impossible. With happens-before, programmers can write and prove properties of concurrent code.

The relation is transitive—if A happens-before B and B happens-before C, then A happens-before C. It enables both theoretical analysis and practical verification of data races.

← Back to the lexicon