Abstract
We formalise the data race free (DRF) guarantee provided by Java, as captured by the semi-formal Java Memory Model (JMM) [1] and published in the Java Language Specification [2].The DRF guarantee says that all programs which are correctly synchronised (i.e., free of data races) can only have sequentially consistent behaviours. Such programs can be understood intuitively by programmers. Formalisation has achieved three aims. First, we made definitions and proofs precise, leading to a better understanding; our analysis found several hidden inconsistencies and missing details. Second, the formalisation lets us explore variations and investigate their impact in the proof with the aim of simplifying the model; we found that not all of the anticipated conditions in the JMM definition were actually necessary for the DRF guarantee. This allows us to suggest a quick fix to a recently discovered serious bug [3] without invalidating the DRF guarantee. Finally, the formal definition provides a basis to test concrete examples, and opens the way for future work on JMM-aware logics for concurrent programs.
Preview
Unable to display preview. Download preview PDF.
Similar content being viewed by others
References
Manson, J., Pugh, W., Adve, S.V.: The Java memory model. In: POPL 2005. Proceedings of the 32nd ACM SIGPLAN-SIGACT symposium on Principles of Programming Languages, pp. 378–391. ACM Press, New York (2005)
Gosling, J., Joy, B., Steele, G., Bracha, G.: Memory Model. In: Java(TM) Language Specification, 3rd edn. Java Series, pp. 557–573. Addison-Wesley Professional, Reading (2005)
Cenciarelli, P., Knapp, A., Sibilio, E.: The Java memory model: Operationally, denotationally, axiomatically. In: 16th ESOP (2007)
Adve, S.V., Gharachorloo, K.: Shared memory consistency models: A tutorial. Computer 29(12), 66–76 (1996)
Pugh, W.: The Java memory model is fatally flawed. Concurrency - Practice and Experience 12(6), 445–455 (2000)
Peierls, T., Goetz, B., Bloch, J., Bowbeer, J., Lea, D., Holmes, D.: Java Concurrency in Practice. Addison-Wesley Professional, Reading (2005)
Pugh, W., Manson, J.: Java memory model causality test cases (2004), http://www.cs.umd.edu/~pugh/java/memoryModel/CausalityTestCases.html
Manson, J., Pugh, W., Adve, S.V.: The Java memory model. Special POPL Issue (submitted)
Lamport, L.: Time, clocks, and the ordering of events in a distributed system. Commun. ACM 21(7), 558–565 (1978)
Adve, S.: The SC- memory model for Java (2004), http://www.cs.uiuc.edu/~sadve/jmm
Wenzel, M.: The Isabelle/Isar reference manual (2005), http://isabelle.in.tum.de/doc/isar-ref.pdf
Adve, S.V., Aggarwal, J.K.: A unified formalization of four shared-memory models. IEEE Trans. Parallel Distrib. Syst. 4(6), 613–624 (1993)
Kawash, J.: Limitations and Capabilities of Weak Memory Consistency Systems. PhD thesis, The University of Calgary (2000)
Roychoudhury, A.: Formal reasoning about hardware and software memory models. In: George, C.W., Miao, H. (eds.) ICFEM 2002. LNCS, vol. 2495, pp. 423–434. Springer, Heidelberg (2002)
Bacon, D., et al.: The “double-checked locking is broken” declaration (2001), http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
Maessen, J.W., Shen, X.: Improving the Java memory model using CRF. In: OOPSLA, pp. 1–12. ACM Press, New York (2000)
Saraswat, V., Jagadeesan, R., Michael, M., von Praun, C.: A theory of memory models. In: ACM 2007 SIGPLAN Conference on Principles and Practice of Parallel Computing, ACM, New York (2007)
Manson, J.: The Java memory model. PhD thesis, University of Maryland, College Park (2004)
Ábrahám, E., de Boer, F.S., de Roever, W.P., Steffen, M.: An assertion-based proof system for multithreaded Java. TCS 331(2-3), 251–290 (2005)
Flanagan, C., Freund, S.N., Qadeer, S., Seshia, S.A.: Modular verification of multithreaded programs. Theor. Comput. Sci. 338(1-3), 153–183 (2005)
Moore, J.S., Porter, G.: The apprentice challenge. ACM Trans. Program. Lang. Syst. 24(3), 193–216 (2002)
Flanagan, C., Freund, S.N.: Type-based race detection for Java. In: PLDI, pp. 219–232. ACM Press, New York (2000)
Boyapati, C., Rinard, M.: A parameterized type system for race-free Java programs. In: OOPSLA, pp. 56–69. ACM Press, New York (2001)
Huisman, M., Grigore, R., Haack, C., Hurlin, C., Kiniry, J., Petri, G., Poll, E.: Report on thread-modular verification. Mobius project deliverable D3.3 (2007), available from http://mobius.inria.fr
Microsoft: Standard ECMA-335 Common Language Infrastructure (CLI) (2005)
Burckhardt, S., Alur, R., Martin, M.M.K.: Bounded model checking of concurrent data types on relaxed memory models: A case study. In: Ball, T., Jones, R.B. (eds.) CAV 2006. LNCS, vol. 4144, pp. 489–502. Springer, Heidelberg (2006)
Burckhardt, S., Alur, R., Martin, M.M.K.: CheckFence: Checking consistency of concurrent data types on relaxed memory models. In: PLDI, San Diego, California, USA, ACM Press, New York (2007)
Manson, J., Pugh, W.: Semantics of multithreaded Java. Technical Report CS-TR-4215, Dept. of Computer Science, University of Maryland, College Park (2001)
Yang, Y., Gopalakrishnan, G., Lindstrom, G.: UMM: an operational memory model specification framework with integrated model checking capability: Research articles. Concurr. Comput.: Pract. Exper. 17(5-6), 465–487 (2005)
Yang, Y., Gopalakrishnan, G., Lindstrom, G.: Memory-model-sensitive data race analysis. In: Davies, J., Schulte, W., Barnett, M. (eds.) ICFEM 2004. LNCS, vol. 3308, pp. 30–45. Springer, Heidelberg (2004)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Aspinall, D., Ševčík, J. (2007). Formalising Java’s Data Race Free Guarantee. In: Schneider, K., Brandt, J. (eds) Theorem Proving in Higher Order Logics. TPHOLs 2007. Lecture Notes in Computer Science, vol 4732. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74591-4_4
Download citation
DOI: https://doi.org/10.1007/978-3-540-74591-4_4
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-74590-7
Online ISBN: 978-3-540-74591-4
eBook Packages: Computer ScienceComputer Science (R0)