Home Knowledge Base Memory Consistency Models

Memory Consistency Models define the formal rules governing the order in which memory operations (loads and stores) performed by one processor become visible to other processors in a shared-memory multiprocessor system — determining what values a load can legally return, which directly affects the correctness of parallel programs and the performance optimizations that hardware and compilers are allowed to perform.

Why Memory Consistency Matters

Processor A:

STORE x = 1
STORE flag = 1

Processor B:

LOAD flag  → reads 1
LOAD x     → reads ???

Consistency Model Spectrum

ModelStrictnessHardwarePerformance
Sequential Consistency (SC)StrictestNo reorderingSlowest
Total Store Order (TSO)Store-Store preservedx86, SPARCGood
Relaxed / Weak OrderingFew guaranteesARM, RISC-V, POWERFastest
Release ConsistencyExplicit acquire/releaseProgramming modelFlexible

Sequential Consistency (SC)

Total Store Order (TSO) — x86

Relaxed / Weak Ordering — ARM, RISC-V

Memory Barriers / Fences

BarrierEffect
Full fenceNo load/store crosses the fence in either direction
AcquireNo load/store AFTER acquire moves BEFORE it
ReleaseNo load/store BEFORE release moves AFTER it
Store fenceStores before cannot pass stores after
Load fenceLoads before cannot pass loads after

C++ Memory Order (Language Level)

Memory consistency models are the foundation of correct parallel programming — understanding the model of your target architecture is essential because code that works correctly on x86 (TSO) may silently produce wrong results on ARM (relaxed), making memory ordering one of the most subtle and critical aspects of concurrent system design.

memory consistency modelmemory orderingsequential consistencyrelaxed consistencytotal store order

Explore 500+ Semiconductor & AI Topics

From EUV lithography to CUDA optimization — search the full knowledge base or chat with our AI assistant.