The Java Memory Model
This web page is a starting point for discussions of and information
concerning the Java Memory Model (Chapter
17 of the Java
Language Specification). The Java Memory Model defines how threads
interact through memory. It used to be somewhat unclear and unnecessarily
limiting, and so was revised. This is a reference page for that revision.
The official site for JSR 133 - The Java(tm) Memory Model and Thread
Specification Revision - is here.
This page is divded up into several sections:
Reference Material
These reference materials are a good starting point for anyone trying to
understand the memory model. Between them, they cover most of the major
issues involved.
Mailing list
Additional Information
Double-Checked Locking is Broken
Double-checked locking (also known as the multithreaded singleton
pattern) is a widely employed idiom for publishing a singleton object
to multiple threads.
Other information
Older Material (for the memory model historians among you)
This is a list of many of the revisions that the memory model
underwent over the course of its three years in flight. They are mostly
out of date. If you are interested in the model as it stands, your best
bet is the reference material above.
Draft Proposals for the Memory Model
-
Earlier draft spec, incorporates some minor fixes from Draft Final
Spec. (April 23, 2004)
- Proposed Final Draft for
JSR-133 (April 12, 2004)
- Documents about the Unified Memory Model Proposal for
Java, including additional test cases (March 16, 2004)
- Update of JSR-133 Public Review Document,
includes clarifications and minor fixes, does not incorporate
a new formalism. (March 16, 2004)
- Writeup of alternative
formalism for the JSR-133 memory model (March 16, 2004)
- JSR-133
is in public review (March 16, 2004)
-
Experimental version of MP without forbidden executions
(February 24, 2004).
- JSR-133 Public Review Document
(February 2, 2004).
- The competing models of February 6, 2004.
- October 17, 2003
- August 29, 2003: NEW one page description of the Manson/Pugh core memory model (with a one and a half page appendix)
- August 8, 2003: JSR-133 Community Review Document
- August 4, 2003: Proof that reordering is legal under Manson/Pugh
- July 31, 2003: One page description of the Manson/Pugh core memory model (with a one page appendix)
- The full semantics of normal fields are in A New Approach to the Semantics of Multithreaded Java, by Jeremy Manson and William Pugh, Revised Jan 13, 2003.
- The full semantics of final fields are in Final Field Semantics, by Jeremy Manson and William Pugh, Revised April 7, 2003.
- Multithreaded semantics for Java, a
previous version of the semantics. (2001)
- Weak Memory Orders and Object Oriented Programming,
draft of the abstract for an OOPSLA poster session submission
(PDF)
(PS)
- The Java Memory Model is Broken
by William Pugh,
Journal version of the following paper; cleans up
the paper somewhat and removes the naive fixes
suggested in that paper.
- Fixing the Java Memory Model
by William Pugh,
1999 ACM Java Grande
Talks
Additional Background Reading
By Doug Lea
By Cenciarelli et al
-
An
Event-Based Structual Operational Semantics of Multi-Threaded Java,
P. Cenciarelli, A. Knapp, B. Reus, M. Wirsing,
In Jim Alves-Foss (Ed.) Formal Syntax and Semantics Of Java, LNCS 1523, pp. 157--200, Springer, Berlin,
1999.
- From
Sequential To Multi-Threaded Java: An Event-Based Operational Semantics,
P. Cenciarelli, A. Knapp, B. Reus, M. Wirsing,
In Proc. 6^th Int. Conf. Algebraic Methodology and Software Technology, LNCS 1376, pp.
402--417. Springer Verlag. Berlin 1998.
- Verifying
a Compiler Optimization for Multi-Threaded Java,
B. Reus, A. Knapp, P. Cenciarelli, M. Wirsing,
WADT Workshop 97, LNCS.
By Schuster et al.
On other memory models
-
CAPSL Technical Memo 16: (148K gzipped Postscript),
"Location Consistency -- a new Memory Model and Cache Consistency Protocol,"
Guang R. Gao, Vivek Sarkar,
February 16, 1998.
- TLA and TLA+, Lamport et al.
By Arvind et al.
- Improving the Java Memory Model Using CRF, Jan-Willem Maessen, Arvind, and Xiaowei Shen, OOPSLA 2000
-
Commit-Reconcile and Fences (CRF): A New Memory Model for Architects and Compiler
Writers, Xiaowei Shen, Arvind and Larry Rudolph, December 1998, To appear in proceedings of the
26th International Symposium on Computer Architecture, May 1999, Atlanta, Georgia., (14 pages).
- Improving the Java Memory Model Using CRF, Jan-Willem Maessen, Arvind, and Xiaowei Shen, OOPSLA 2000
By others
This page maintained by
William Pugh.
This material is based upon work supported by the National Science Foundation under Grant No. 0098162. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of the National Science Foundation.