Abstract
The Java Memory Model (JMM) formalizes the behavior of shared memory accesses in a multithreaded Java program. Dependencies between memory accesses are acyclic, as defined by the JMM causality requirements. We study the problem of post-mortem verification of these requirements and prove that the task is NP-complete. We then argue that in some cases the task may be simplified either by considering a slightly stronger memory model or by tracing the actual execution order of Read actions in each thread. Our verification algorithm has two versions: a polynomial version, to be used when one of the aforementioned simplifications is possible, and a non-polynomial version – for short test sequences only – to be used in all other cases. Finally, we argue that the JMM causality requirements could benefit from some fine-tuning. Our examination of causality test case 6 (presented in the public discussion of the JMM) clearly shows that some useful compiler optimizations – which one would expect to be permissible – are in fact prohibited by the formal model.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Causality Test Cases, http://www.cs.umd.edu/~pugh/java/memoryModel/CausalityTestCases.html
JSR-133: Java Memory Model and Thread Specification (August 2004), http://www.cs.umd.edu/~pugh/java/memoryModel/jsr133.pdf
Adve, S.V., Hill, M.D.: A unified formalization of four shared-memory models. IEEE Trans. on Parallel and Distributed Systems 4(6), 613–624 (1993)
Adve, S.V., Manson, J., Pugh, W.: The Java Memory Model. In: POPL 2005 (2005)
Adve, S.V., Gharachorloo, K., Gupta, A., Hennessy, J.L., Hill, M.D.: Sufficient System Requirements for Supporting the PLpc Memory Model. Technical Report #1200, University of Wisconsin-Madison (1993)
Alexandrescu, A., Boehm, H., Henney, K., Lea, D., Pugh, B.: Memory model for multithreaded C++ (2004), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2004/n1680.pdf
Boehm, H., Lea, D., Pugh, B.: Implications of C++ Memory Model Discussions on the C Language (2005), http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1131.pdf
Boehm, H.-J.: Threads cannot be implemented as a library. SIGPLAN Not., 40(6), 261–268 (2005)
Charles, W.K.: The UPC Memory Model: Problems and Prospects. In: Proceedings of the International Parallel and Distributed Processing Symphosium. IEEE, Los Alamitos (2004)
Doug, L.: The JSR-133 Cookbook for Compiler Writers, http://gee.cs.oswego.edu/dl/jmm/cookbook.html
Gharachorloo, K., Adve, S.V., Gupta, A., Hennessy, J.L., Hill, M.D.: Programming for different memory consistency models. Journal of Parallel and Distributed Computing 15(4), 399–407 (1992)
Gharachorloo, K., Adve, S.V., Gupta, A., Hennessy, J.L., Hill, M.D.: Specifying System Requirements for Memory Consistency Models. Technical Report #CSLTR- 93-594, Stanford University (1993)
Gharachorloo, K., Lenoski, D., Laudon, J., Gibbons, P., Gupta, A., Hennessy, J.: Memory consistency and event ordering in scalable shared-memory multiprocessors. In: Proceedings of the 17th Intl. Symp. on Computer Architecture, May 1990, pp. 15–26 (1990)
Gibbons, P.B., Korach, E.: New results on the complexity of sequential consistency. Technical report, AT&T Bell Laboratories, Murray Hill NJ (September 1993)
Gosling, J., Joy, B., Steele, G., Bracha, G.: The Java Language Specification, 3rd edn. Addison-Wesley, Reading (2005)
Kohli, P., Neiger, G., Ahamad, M.: A Characterization of Scalable Shared Memories. Technical Report GIT-CC-93/04, College of Computing, Georgia Institute of Technology, Atlanta, Georgia 30332-0280 (January 1993)
The Java Memory Model mailing list archive, http://www.cs.umd.edu/~pugh/java/memoryModel/archive
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2006 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Polyakov, S., Schuster, A. (2006). Verification of the Java Causality Requirements. In: Ur, S., Bin, E., Wolfsthal, Y. (eds) Hardware and Software, Verification and Testing. HVC 2005. Lecture Notes in Computer Science, vol 3875. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11678779_16
Download citation
DOI: https://doi.org/10.1007/11678779_16
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-32604-5
Online ISBN: 978-3-540-32605-2
eBook Packages: Computer ScienceComputer Science (R0)