ScholarGate
어시스턴트

Memory Consistency Models

A memory consistency model specifies which values reads may observe when concurrent threads access shared memory, defining the ordering guarantees programmers can rely on.

PaperMind(으)로 주제 찾기곧 제공Find papers & topics
Tools & resources
슬라이드 다운로드
Learn & explore
동영상곧 제공

Definition

A memory consistency model is a formal specification of the values that read operations may return in a concurrent execution, fixing the orderings of memory accesses that the language, compiler, and hardware must respect.

Scope

This topic covers the spectrum of consistency models from sequential consistency to relaxed and weak models, the happens-before relation and data-race-free guarantees, hardware memory orderings (such as total store order), and language-level memory models for C++ and Java. It addresses why relaxed models exist, how fences and atomics restore ordering, and how to reason soundly about concurrent memory.

Core questions

  • What orderings of memory operations may a program legally observe?
  • Why do relaxed memory models exist and what do they permit?
  • How does the data-race-free guarantee simplify reasoning?
  • How do fences and atomic operations enforce ordering?

Key theories

Sequential consistency
Lamport defined sequential consistency, in which a multiprocessor execution must appear as some single interleaving of operations that respects each processor's program order, the strongest intuitive baseline model.
Relaxed consistency and the SC-for-DRF guarantee
Adve and Gharachorloo explain relaxed models and the principle that data-race-free programs behave as if sequentially consistent, reconciling performance with programmability.
Language-level memory models
Manson, Pugh, and Adve formalized the Java memory model using a happens-before relation, defining what optimizations are legal and what guarantees even racy programs receive.

Clinical relevance

Because multicore processors and optimizing compilers reorder memory operations, language memory models are essential to writing correct, portable concurrent code. They tell programmers when synchronization is required and define the guarantees libraries and runtimes can offer.

History

Lamport formalized sequential consistency in 1979. As hardware adopted relaxed orderings for performance, Adve and Gharachorloo's 1996 tutorial codified the consistency-model landscape and the data-race-free framework. Language designers then built memory models into specifications, with the Java memory model (2005) and the C++11 memory model establishing the modern approach.

Debates

Semantics of racy programs
A difficult question is what guarantees, if any, to give programs containing data races; language models must prevent 'out-of-thin-air' values while still permitting aggressive compiler and hardware optimizations.

Key figures

  • Leslie Lamport
  • Sarita Adve
  • Kourosh Gharachorloo
  • William Pugh
  • Jeremy Manson

Related topics

Seminal works

  • lamport1979
  • adve1996
  • manson2005

Frequently asked questions

Why don't all systems just use sequential consistency?
Sequential consistency forbids many compiler and hardware optimizations that improve performance, so most real systems adopt relaxed models and provide synchronization primitives to recover stronger ordering only where needed.
What is the data-race-free guarantee?
Under many language memory models, a program that contains no data races (all conflicting accesses are properly synchronized) is guaranteed to behave as if memory were sequentially consistent.

Methods for this concept

Related concepts