Formalizing the Java Memory Model for Multithreaded Program Correctness and Optimization

Standardized language level support for threads is one of the most important features of Java. However, defining and understanding the Java Memory Model (JMM) has turned out to be a big challenge. Several models produced to date are not as easily comparable as first thought. Given the growing interest in multithreaded Java programming, it is essential to have a sound framework that would allow formal specification and reasoning about the JMM. This paper presents the Uniform Memory Model (UMM), a formal memory model specification framework. With a flexible architecture, it can be easily configured to capture different shared memory semantics including both architectural and language level memory models. Based on guarded commands, UMM is integrated with a model checking utility, providing strong built-in support for formal verification and program analysis. A formal specification of the JMM following the semantics proposed by Manson and Pugh is presented in UMM. Systematic analysis has revealed interesting properties of the proposed semantics. In addition, several mistakes from the original specification have been uncovered. Formalizing the Java Memory Model for Multithreaded Program Correctness and Optimization Yue Yang, Ganesh Gopalakrishnan, and Gary Lindstrom School of Computing, University of Utah {yyang | ganesh | gary}@cs.utah.edu

[1]  Rob Gerth Sequential consistency and the lazy caching algorithm , 1999, Distributed Computing.

[2]  David L Weaver,et al.  The SPARC architecture manual : version 9 , 1994 .

[3]  Alan L. Cox,et al.  Lazy release consistency for software distributed shared memory , 1992, ISCA '92.

[4]  Xiaowei Shen,et al.  Improving the Java memory model using CRF , 2000, OOPSLA '00.

[5]  David L. Dill,et al.  Formal specification of abstract memory models , 1993 .

[6]  Tulika Mitra,et al.  Specifying multithreaded Java semantics for program verification , 2002, ICSE '02.

[7]  Kourosh Gharachorloo,et al.  Memory consistency models for shared-memory multiprocessors , 1995 .

[8]  Assaf Schuster,et al.  Java consistency: nonoperational characterizations for Java memory behavior , 2000, TOCS.

[9]  William W. Collier,et al.  Reasoning about parallel architectures , 1992 .

[10]  Vivek Sarkar,et al.  Location Consistency-A New Memory Model and Cache Consistency Protocol , 2000, IEEE Trans. Computers.

[11]  Larry Rudolph,et al.  Commit-reconcile & fences (CRF): a new memory model for architects and compiler writers , 1999, ISCA.

[12]  William Pugh,et al.  Core semantics of multithreaded Java , 2001, JGI '01.

[13]  William Pugh Fixing the Java memory model , 1999, JAVA '99.

[14]  Ganesh Gopalakrishnan,et al.  Analyzing the CRF Java memory model , 2001, Proceedings Eighth Asia-Pacific Software Engineering Conference.

[15]  Leslie Lamport,et al.  How to Make a Multiprocessor Computer That Correctly Executes Multiprocess Programs , 2016, IEEE Transactions on Computers.

[16]  Sarita V. Adve,et al.  Shared Memory Consistency Models: A Tutorial , 1996, Computer.

[17]  David L. Dill,et al.  An Executable Specification and Verifier for Relaxed Memory Order , 1999, IEEE Trans. Computers.

[18]  Anoop Gupta,et al.  Specifying system requirements for memory consistency models , 1993 .

[19]  K. Gharachodoo,et al.  Memory consistency models for shared memory multiprocessors , 1996 .

[20]  William Pugh,et al.  Semantics of Multithreaded Java , 2001 .

[21]  Brian Case,et al.  SPARC architecture , 1992 .