Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/1040305.1040336acmconferencesArticle/Chapter ViewAbstractPublication PagespoplConference Proceedingsconference-collections
Article

The Java memory model

Published: 12 January 2005 Publication History

Abstract

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#.

References

[1]
Ada Joint Program Office. Ada 95 Rationale. Intermetrics, Inc., Cambridge, Massachusetts, 1995.]]
[2]
Sarita Adve. Designing Memory Consistency Models for Shared-Memory Multiprocessors. PhD thesis, University of Wisconsin, Madison, December 1993. Ph.D. Thesis.]]
[3]
Sarita Adve and Kourosh Gharachorloo. Shared memory consistency models: A tutorial. IEEE Computer, 29(12):66--76, 1996.]]
[4]
Sarita Adve and Mark Hill. Weak ordering---A new definition. In Proc. of the 17th Annual Int'l Symp. on Computer Architecture (ISCA'90), pages 2--14, 1990.]]
[5]
Sarita V. Adve. The SC- memory model for Java, 2004. http://www.cs.uiuc.edu/~sadve/jmm.]]
[6]
Sarita V. Adve and Mark D. Hill. A unified formalization of four shared-memory models. IEEE Trans. on Parallel and Distributed Systems, 4(6):613--624, June 1993.]]
[7]
Sarita V. Adve and Mark D. Hill. Sufficient conditions for implementing the data-race-free-1 memory model. Technical Report #1107, Computer Sciences Department, University of Wisconsin-Madison, September 1992.]]
[8]
Arvind, Jan-Willem Maessen, and Xiaowei Shen. Improving the Java memory model using CRF. In OOPSLA, pages 1--12, October 2000.]]
[9]
John K. Bennett, John B. Carter, and Willy Zwanaepoel. Adaptive software cache management for distributed shared memory architectures. In Proc. 17th Annual Intl. Symp. on Computer Architecture, May 1990.]]
[10]
Gianfranco Bilardi and Keshav Pingali. A Framework for Generalized Control Dependence. In ACM SIGPLAN 1996 Conference on Programming Language Design and Implementation, Philadelphia, Pennsylvania, United States, June 1996.]]
[11]
Christopher Brumme. C# memory model. http://blogs.msdn.com/cbrumme/archive/2003/05/17/51445.apx.]]
[12]
Michel Dubois, Christoph Scheurich, and Faye A. Briggs. Memory access buffering in multiprocessors. In Proc. 13th Ann. Intl. Symp. on Computer Architecture, pages 434--442, June 1986.]]
[13]
ECMA. Common Language Infrastructure (CLI), December 2002. http://www.ecma-international.org/publications/standards/Ecma-335.htm.]]
[14]
Kourosh Gharachorloo. Memory consistency models for shared-memory multiprocessors. PhD thesis, Stanford University, 1996.]]
[15]
Kourosh Gharachorloo, Sarita V. Adve, Anoop Gupta, John L. Hennessy, and Mark D. Hill. Programming for different memory consistency models. Journal of Parallel and Distributed Computing, 15(4):399--407, August 1992.]]
[16]
Kourosh Gharachorloo, Anoop Gupta, and John Hennessy. Two techniques to enhance the performance of memory consistency models. In Proc. Intl. Conf. on Parallel Processing, pages I355--I364, 1991.]]
[17]
Kourosh Gharachorloo, Daniel Lenoski, James Laudon, Phillip Gibbons, Anoop Gupta, and John Hennessy. Memory consistency and event ordering in scalable shared-memory multiprocessors. In Proc. 17th Ann. Intl. Symp. on Computer Architecture, pages 15--26, May 1990.]]
[18]
James Gosling, Bill Joy, and Guy Steele. The Java Language Specification. Addison Wesley, 1996.]]
[19]
IBM System/370 Principles of Operation, May 1983. Publication Number GA22-7000-9, File Number S370-01.]]
[20]
Java Specification Request (JSR) 133. Java Memory Model and Thread Specification Revision, 2004. http://jcp.org/jsr/detail/133.jsp.]]
[21]
The Java memory model. Mailing list and web page. http://www.cs.umd.edu/users/pugh/java/memoryModel.]]
[22]
Pete Keleher, Alan L. Cox, and Willy Zwaenepoel. Lazy release consistency for software distributed shared memory. In Proc. 19th Ann. Intl. Symp. on Computer Architecture, pages 13--21, 1992.]]
[23]
B. W. Kernighan and D. M. Ritchie. The C Programming Language. Prentice Hall, second edition, 1988.]]
[24]
Vishnu Kotrajaras. Towards an Improved Memory Model for Java. PhD thesis, Department of Computing, Imperial College, August 2001.]]
[25]
Leslie Lamport. Time, clocks, and the ordering of events in a distributed system. CACM, 21(7):558--564, 1978.]]
[26]
Leslie Lamport. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Transactions on Computers, 9(29):690--691, 1979.]]
[27]
Bil Lewis and Daniel J. Berg. Multithreaded programming with pthreads. Sun Microsystems, 2550 Garcia Avenue, Mountain View, CA 94043, USA, 1998.]]
[28]
Jeremy Manson and William Pugh. Core semantics of multithreaded Java. In ACM Java Grande Conference, June 2001.]]
[29]
Jeremy Manson and William Pugh. Semantics of Multithreaded Java. Technical Report CS-TR-4215, Dept. of Computer Science, University of Maryland, College Park, March 2001.]]
[30]
Jeremy Manson and William Pugh. Requirements for Programming Language Memory Models. In PODC Workshop on Concurrency and Synchronization in Java Programs, St. John's, Newfoundland, Canada, July 2004.]]
[31]
C. May et al., editors. The PowerPC Architecture: A Specification for a New Family of RISC Processors. Morgan Kaufmann, San Francisco, 1994.]]
[32]
Andy Podgurski and Lori Clarke. A formal model of program dependences and its implications for software testing debugging and maintenance. IEEE Transactions on Software Engineering, 1990.]]
[33]
William Pugh. Fixing the Java memory model. In ACM Java Grande Conference, June 1999.]]
[34]
William Pugh. The Java memory model is fatally flawed. Concurrency: Practice and Experience, 12(1):1--11, 2000.]]
[35]
Parthasarathy Ranganathan, Vijay S. Pai, and Sarita V. Adve. Using speculative retirement and larger instruction windows to narrow the performance gap between memory consistency models. In Proceedings of the 9th Annual ACM Symposium on Parallel Algorithms and Architectures, pages 199--210, 1997.]]
[36]
Vijay Saraswat. Concurrent Constraint-based Memory Machines: A framework for Java Memory Models. Technical report, IBM TJ Watson Research Center, March 2004.]]
[37]
Douglas Schmidt and Tim Harrison. Double-checked locking: An optimization pattern for efficiently initializing and accessing thread-safe objects. In 3rd Annual Pattern Languages of Program Design Conference, 1996.]]
[38]
Dennis Shasha and Marc Snir. Efficient and correct execution of parallel programs that share memory. ACM Trans. on Programming Languages and Systems, 10(2):282--312, April 1988.]]
[39]
Xiaowei Shen, Arvind, and Larry Rudolph. Commit-reconcile & fences (CRF): A new memory model for architects and compiler writers. Proceedings of the 26th International Symposium on Computer Archite cture, 1999.]]
[40]
R. L. Sites and R. T. Witek, editors. Alpha AXP Architecture Reference Manual. Digital Press, Boston, 1995. 2nd edition.]]
[41]
Bjarne Stroustrup. The C++ Programming Language. Addison-Wesley Longman, Reading Mass. USA, 3rd edition, 1997.]]
[42]
Z. Sura, C.-L. Wong, X. Fang, J. Lee, S. Midkiff, and D. Padua. Automatic implementation of programming language consistency models. In Proc. of the 15th International Workshop on Languages and Compilers for Parallel Computing (LCPC'02), 2002. To appear Lecture Notes in Computer Science, Springer-Verlag.]]
[43]
David Weaver and Tom Germond. The SPARC Architecture Manual, version 9. Prentice-Hall, 1994.]]
[44]
Yue Yang, Ganesh Gopalakrishnan, and Gary Lindstrom. Specifying Java thread semantics using a uniform memory model. In ACM Java Grande Conference, November 2001.]]
[45]
Yue Yang, Ganesh Gopalakrishnan, and Gary Lindstrom. Formalizing the Java memory model for multithreaded program correctness and optimization. Technical Report UUCS-02-011, University of Utah, April 2002.]]

Cited By

View all
  • (2024)Semantics of Remote Direct Memory Access: Operational and Declarative Models of RDMA on TSO ArchitecturesProceedings of the ACM on Programming Languages10.1145/36897818:OOPSLA2(1982-2009)Online publication date: 8-Oct-2024
  • (2024)Jmvx: Fast Multi-threaded Multi-version Execution and Record-Replay for Managed LanguagesProceedings of the ACM on Programming Languages10.1145/36897698:OOPSLA2(1641-1669)Online publication date: 8-Oct-2024
  • (2024)Reducing Write Barrier Overheads for Orthogonal PersistenceProceedings of the 17th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3687997.3695646(210-223)Online publication date: 17-Oct-2024
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
POPL '05: Proceedings of the 32nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
January 2005
402 pages
ISBN:158113830X
DOI:10.1145/1040305
  • General Chair:
  • Jens Palsberg,
  • Program Chair:
  • Martín Abadi
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 40, Issue 1
    Proceedings of the 32nd ACM SIGPLAN-SIGACT symposium on Principles of programming languages
    January 2005
    391 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1047659
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 12 January 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Java
  2. concurrency
  3. memory model
  4. multithreading

Qualifiers

  • Article

Conference

POPL05

Acceptance Rates

Overall Acceptance Rate 824 of 4,130 submissions, 20%

Upcoming Conference

POPL '25

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)122
  • Downloads (Last 6 weeks)17
Reflects downloads up to 23 Dec 2024

Other Metrics

Citations

Cited By

View all
  • (2024)Semantics of Remote Direct Memory Access: Operational and Declarative Models of RDMA on TSO ArchitecturesProceedings of the ACM on Programming Languages10.1145/36897818:OOPSLA2(1982-2009)Online publication date: 8-Oct-2024
  • (2024)Jmvx: Fast Multi-threaded Multi-version Execution and Record-Replay for Managed LanguagesProceedings of the ACM on Programming Languages10.1145/36897698:OOPSLA2(1641-1669)Online publication date: 8-Oct-2024
  • (2024)Reducing Write Barrier Overheads for Orthogonal PersistenceProceedings of the 17th ACM SIGPLAN International Conference on Software Language Engineering10.1145/3687997.3695646(210-223)Online publication date: 17-Oct-2024
  • (2024)CPElide: Efficient Multi-Chiplet GPU Implicit Synchronization2024 57th IEEE/ACM International Symposium on Microarchitecture (MICRO)10.1109/MICRO61859.2024.00058(700-717)Online publication date: 2-Nov-2024
  • (2024)A Denotational Approach to Release/Acquire ConcurrencyProgramming Languages and Systems10.1007/978-3-031-57267-8_5(121-149)Online publication date: 6-Apr-2024
  • (2023)Memory Consistency Models for Program Transformations: An Intellectual AbstractProceedings of the 2023 ACM SIGPLAN International Symposium on Memory Management10.1145/3591195.3595274(30-42)Online publication date: 6-Jun-2023
  • (2023)Probabilistic Concurrency Testing for Weak Memory ProgramsProceedings of the 28th ACM International Conference on Architectural Support for Programming Languages and Operating Systems, Volume 210.1145/3575693.3575729(603-616)Online publication date: 27-Jan-2023
  • (2023)Improving the Scalability of GPU Synchronization PrimitivesIEEE Transactions on Parallel and Distributed Systems10.1109/TPDS.2022.321850834:1(275-290)Online publication date: 1-Jan-2023
  • (2023)Instrumentation for RV: From Basic Monitoring to Advanced Use CasesRuntime Verification10.1007/978-3-031-44267-4_23(403-427)Online publication date: 1-Oct-2023
  • (2023)Model Checking Race-Freedom When “Sequential Consistency for Data-Race-Free Programs” is GuaranteedComputer Aided Verification10.1007/978-3-031-37703-7_13(265-287)Online publication date: 17-Jul-2023
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media