The Java Memory Model
The Java memory model, as described in
chapter 17 of the
Java Language Specification defines how threads interact
through memory. It used to be somewhat unclear and unnecessarily limiting,
but
some folks decided this was a bad idea and revised it. I was one of those
people.
Brian Goetz and I wrote something of a gentle introduction to some of the
issues. It may help you
to understand the implications of this work.
This page mostly details my contributions to the work. For more of an
introduction to the material,
click here .
Relevant Publications
- The Java Memory Model. Jeremy Manson, William Pugh and Sarita Adve.
A journal version that combines my thesis, the POPL paper and the CSJP
paper. For academics, this is probably the most interesting version
of the paper.
pdf .
- The Java Memory Model. Jeremy Manson, William Pugh and Sarita Adve. In
Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming
Languages, POPL 2005. Long Beach, California. January, 2005.
pdf .
- The Java Memory Model. Jeremy Manson. Ph.D. Dissertation.
September, 2004.
pdf .
- Requirements for a Programming Language Memory Model. Jeremy
Manson and William Pugh. Workshop on Concurrency and Synchronization
in Java Programs, in association with PODC. July, 2004.
pdf .
- Manson, Jeremy. The Design and Verification of Java's Memory Model.
In OOPSLA 2002 Doctoral Symposium.
postscript ,
PDF .
- Manson, Jeremy and Pugh, William. The Java Memory Model Simulator.
In
Workshop on Formal Techniques for Java-like Programs, in association
with ECOOP. June, 2002.
PostScript version,
PDF version.
- Manson, Jeremy and Pugh, William. Semantics of Multithreaded Java.
Department of Computer Science, University of Maryland, College Park,
CS-TR-4215.
compressed postscript ,
ordinary postscript
- Manson, Jeremy. Virtual Machine Implementation Issues for the
Revised Java Memory Model. University of Maryland, December 2001. M.S.
Thesis. PDF
- Manson, Jeremy and Pugh, William. Core Semantics of Multithreaded
Java. In ACM Java Grande
. June, 2001. See "Semantics of Multithreaded Java" above instead.
Talk Slides
- In June 2005, I gave a talk at IBM. Those slides are
here.
- In June 2004, Bill Pugh and I
gave a talk at a large, well-attended Java conference. The slides are
here.
-
We also gave an invited talk about the memory model at Dagstuhl in 2003. The slides are
available here.
-
We also gave a semi-invited talk about the memory model at 2002's
ECOOP Workshop on Formal Techniques for Java-like Programs
in combination with the simulator paper (above). The slides
are available on line:
PDF,
ppt.
The Java Memory Model Simulator
I have written a simulator for the model. I am fairly well aware that
there are bugs in it. I know of at least one example on which it produces
incomplete results.
If you have questions, or you have suggestions on how it can be
improved, or you find errors (especially if you find errors!) email me
at
jmanson@nospamcs.umd.edu . But take out the "nospam" part first.
David Hovemeyer did a good chunk of the work as well.
The Documentation
- We presented a paper on the simulator at 2002's
ECOOP Workshop on Formal Techniques for Java-like Programs
. PostScript version,
PDF version. It has
changed substantially since then; there is more information about how it
works in my dissertation (above).
- To understand the simulator, you really need the readme.
The readme dates from the earlier version, so the information on the back
end has changed (and users can ignore the information about prescient
writes / initWrites), but the information on how to get it to work is
more-or-less current.
PostScript
version, PDF version .
- A set of litmus tests for the simulator are available.
tar.gz format .
The Java Version
The Haskell Version
I wrote a version of the 2002 simulator in Java. It doesn't implement the
correct model, so it is only really here out of curiosity.
- The simulator for Windows in
zip format (this requires
an unzip program, like
Winzip,
pkzip or the builtin one in
Windows XP). Tested on NT 4.
- The simulator for Solaris in
tar.gz
format . Tested on Solaris 2.6.
- The simulator for Linux in
tar.gz
format . Tested on RedHat 7.2.
- The source code for the simulator in
tar.gz format .
The simulator is written in a mix of Haskell and Java. Compilation
requires a Java compiler, a reasonable make utility, and The Glasgow Haskell Compiler .
Back to Jeremy Manson's
home page