Lukas' Notes

memory

Definition

Sequentially Consistent Memory

A sequentially consistent memory model is a memory model in which the operations of all threads appear as one total order that preserves each thread’s local program order.

Formally, for every thread and operations in its program order, the global order satisfies

Thus, every execution is equivalent to some sequential interleaving of the threads’ operations.

Simplicity

Sequential consistency is the simplest model for reasoning about shared memory: each thread acts as if it were executing alone, but the threads are interleaved globally.

Every read sees the most recent write in that global order.

Limitation

Not the default on modern hardware

Modern processors do not usually enforce sequential consistency directly. Compiler optimisations, out-of-order execution, write buffers, and caches can reorder operations unless the programmer uses stronger synchronisation primitives.