Concurrent Programming in Java
© 1996-1999 Doug Lea
2.2 Synchronization
Follow-ups
Section 2.2.4 (Statics and Singletons)
As of the second edition of the Java Language Specification, the
remark about relying on static initializers can be strengthened: The
specification
now promises that statics will NOT be initialized until
immediately before a class is used. (Although the sense of
"used" can require caution. For example, for class C, a reference to
C.class appears to count as a use.) See the JMM
page on double-check for some guidance on exploiting this
guarantee in solving lazy initialization problems.
Readings and Resources
For information about ongoing work on the memory model, see Bill Pugh's
Java Memory Model site. This includes web pages, downloadable
slides and papers, mailing list archives, and links presenting more
details on the interactions between synchronization and memory
access, and the current status of the revised memory model
specification.
Features of computer architectures that impact multithreaded programs
are described in:
-
Schimmel, Curt. UNIX Systems for Modern Architectures Symmetric
Multiprocessing and Caching for Kernel Programmers, Addison-Wesley,
1994.
- Patterson, David, and John Hennessy. Computer Organization and
Design: The Hardware/Software Interface, Morgan Kaufmann, 1997.
See also
the supplement
with links to further resources on specific machine architectures.
Memory consistency models are the subject of increasing attention as
both multiprocessors and multithreaded programs become more common
and their interactions become more of a concern. At least with
respect to locking, the Java memory model is closest to the family
of release consistency models. For an overview, see:
- Adve, Sarita and
K. Gharachorloo. ``Shared Memory Consistency Models: A Tutorial'',
IEEE Computer, December 1996, 66-76; as well as the follow-up:
``Recent Advances in Memory Consistency Models for Hardware
Shared-Memory Systems'' Proceedings of the IEEE, special issue
on distributed shared-memory, 1999.
Doug Lea
Last modified: Sat Oct 21 19:23:29 EDT 2000