The Java memory model

Jeremy Manson, William Pugh, Sarita V. Adve

Research output: Contribution to journalConference articlepeer-review


This paper describes the new Java memory model, which has been revised as part of Java 5.0. The model specifies the legal behaviors for a multithreaded program; it defines the semantics of multithreaded Java programs and partially determines legal implementations of Java virtual machines and compilers. The new Java model provides a simple interface for correctly synchronized programs - it guarantees sequential consistency to data-race-free programs. Its novel contribution is requiring that the behavior of incorrectly synchronized programs be bounded by a well defined notion of causality. The causality requirement is strong enough to respect the safety and security properties of Java and weak enough to allow standard compiler and hardware optimizations. To our knowledge, other models are either too weak because they do not provide for sufficient safety/security, or are too strong because they rely on a strong notion of data and control dependences that precludes some standard compiler transformations. Although the majority of what is currently done in compilers is legal, the new model introduces significant differences, and clearly defines the boundaries of legal transformations. For example, the commonly accepted definition for control dependence is incorrect for Java, and transformations based on it may be invalid. In addition to providing the official memory model for Java, we believe the model described here could prove to be a useful basis for other programming languages that currently lack well-defined models, such as C++ and C#.

Original languageEnglish (US)
Pages (from-to)378-391
Number of pages14
JournalConference Record of the Annual ACM Symposium on Principles of Programming Languages
StatePublished - 2005
EventPOPL 2005: The 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages - Long Beach, CA, United States
Duration: Jan 12 2005Jan 14 2005


  • Concurrency
  • Java
  • Memory Model
  • Multithreading

ASJC Scopus subject areas

  • Software


Dive into the research topics of 'The Java memory model'. Together they form a unique fingerprint.

Cite this