Java Memory Model JMM
Formalised in JSR-133. Defines happens-before (HB) based on synchronisation actions. Provides DRF-SC guarantee. Known for complexities around causality and out-of-thin-air values.
Properties
Property vector survey-sourced — from Tables 1–2 of the Moiseenko et al. survey, except cells that cite a specific source.
- Compilation optimal mapping to
- yes x86
- no POWER
- yes Armv7
- yes Armv8
- Reordering sound
- yes Store→Load
- yes Store→Store
- yes Load→Load
- yes Load→Store
- Elimination sound
- yes Store/Load
- yes Store/Store
- no Load/Load
- no Load/Store
- Other local transformations
- yes Irrelevant load elim.
- no Speculative load intro.
- no Roach motel
- yes Trace preserving
- no Common subexpr. elim.
- Global transformations
- no Thread inlining
- Reasoning guarantees
- yes External DRF
- no Coherence
- yes No undefined behaviour
- no In-order execution
- yes No out-of-thin-air
Ordering relationships
- Strictly weaker than
- Sequential Consistency (SC) — JMM guarantees SC for data-race-free programs but allows reordering for racy accesses.
- Incomparable with
- OCaml Memory Model (OCaml MM) — Both are language-level models providing DRF-SC but with different treatments of racy accesses.
- Java Access Modes (JAM) — JAM is a proposed revision of the JMM built on VarHandle access modes (plain/opaque/release-acquire/volatile); it strengthens the treatment of atomics via RC11 while differing from the original JMM's causality machinery, so neither contains the other.
- Operational Happens-Before Model (OHMM) — OHMM is an operational attempt to repair the JMM — a global event buffer with a replay mechanism, tracking syntactic dependencies to forbid thin-air. It restructures the JMM's semantics rather than strictly refining it, so the two are incomparable.
References
- Jeremy Manson, William Pugh, Sarita V. Adve. The Java Memory Model. POPL 2005, 2005. doi:10.1145/1040305.1040336
- Doug Lea, Jeremy Manson, William Pugh. JSR-133: Java Memory Model and Thread Specification. Java Community Process, 2004. www.cs.umd.edu/~pugh/java/memoryModel/