Advertisement

Java and the Java Memory Model — A Unified, Machine-Checked Formalisation

  • Andreas Lochbihler
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7211)

Abstract

We present a machine-checked formalisation of the Java memory model and connect it to an operational semantics for Java source code and bytecode. This provides the link between sequential semantics and the memory model that has been missing in the literature. Our model extends previous formalisations by dynamic memory allocation, thread spawns and joins, infinite executions, the wait-notify mechanism and thread interruption. We prove the Java data race freedom guarantee for the complete formalisation in a modular way. This work makes the assumptions about the sequential semantics explicit and shows how to discharge them.

Keywords

Operational Semantic Type Information Memory Allocation Data Race Sequentially Consistent 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.

References

  1. 1.
    Adve, S., Gharachaorloo, K.: Shared memory consistency models: A tutorial. IEEE Computer 29(12), 66–76 (1996)CrossRefGoogle Scholar
  2. 2.
    Adve, S., Hill, M.D.: Weak ordering - a new definition. In: ISCA 1990, pp. 2–14. ACM (1990)Google Scholar
  3. 3.
    Adve, S.V., Boehm, H.J.: Memory models: A case for rethinking parallel languages and hardware. Commun. ACM 53, 90–101 (2010)CrossRefGoogle Scholar
  4. 4.
    Aspinall, D., Ševčík, J.: Formalising Java’s Data Race Free Guarantee. In: Schneider, K., Brandt, J. (eds.) TPHOLs 2007. LNCS, vol. 4732, pp. 22–37. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  5. 5.
    Batty, M., Memarian, K., Owens, S., Sarkar, S., Sewell, P.: Clarifying and compiling C/C++ concurrency: From C++11 to POWER. In: POPL 2012, pp. 509–520. ACM (2012)Google Scholar
  6. 6.
    Batty, M., Owens, S., Sarkar, S., Sewell, P., Weber, T.: Mathematizing C++ concurrency. In: POPL 2011, pp. 55–66. ACM (2011)Google Scholar
  7. 7.
    Boehm, H.J., Adve, S.V.: Foundations of the C++ concurrency memory model. In: PLDI 2008, pp. 68–78. ACM (2008)Google Scholar
  8. 8.
    Boyland, J.: An operational semantics including “volatile” for safe concurrency. Journal of Object Technology 8(4), 33–53 (2009); FTfJP 2008MathSciNetCrossRefGoogle Scholar
  9. 9.
    Cenciarelli, P., Knapp, A., Sibilio, E.: The Java Memory Model: Operationally, Denotationally, Axiomatically. In: De Nicola, R. (ed.) ESOP 2007. LNCS, vol. 4421, pp. 331–346. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  10. 10.
    Gosling, J., Joy, B., Stelle, G., Bracha, G.: The Java Language Specification, 3rd edn. Addison-Wesley (2005)Google Scholar
  11. 11.
    Huisman, M., Petri, G.: The Java Memory Model: a formal explanation. In: VAMP 2007, pp. 81–96, Tech. Rep. ICIS-R07021, University of Nijmegen (2007)Google Scholar
  12. 12.
    International standard ISO/IEC 14882:2011. programming languages – C++. International Organization for Standardization (2011)Google Scholar
  13. 13.
    Jagadeesan, R., Pitcher, C., Riely, J.: Generative Operational Semantics for Relaxed Memory Models. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 307–326. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  14. 14.
    Klein, G., Nipkow, T.: A machine-checked model for a Java-like language, virtual machine and compiler. ACM TOPLAS 28(4), 619–695 (2006)CrossRefGoogle Scholar
  15. 15.
    Lamport, L.: How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comput. 28, 690–691 (1979)MATHCrossRefGoogle Scholar
  16. 16.
    Lochbihler, A.: Type safe nondeterminism - a formal semantics of Java threads. In: Foundations of Object-Oriented Languages, FOOL 2008 (2008)Google Scholar
  17. 17.
    Lochbihler, A.: Verifying a Compiler for Java Threads. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 427–447. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  18. 18.
    Lochbihler, A.: Jinja with threads. In: Klein, G., Nipkow, T., Paulson, L. (eds.) The Archive of Formal Proofs (2011), http://afp.sourceforge.net/entries/JinjaThreads.shtml, formal proof development
  19. 19.
    Lochbihler, A.: A unified, machine-checked formalisation of Java and the Java Memory Model. Tech. Rep. 2011-34, Karlsruhe Reports in Informatics (2011)Google Scholar
  20. 20.
    Lochbihler, A., Bulwahn, L.: Animating the Formalised Semantics of a Java-Like Language. In: van Eekelen, M., Geuvers, H., Schmaltz, J., Wiedijk, F. (eds.) ITP 2011. LNCS, vol. 6898, pp. 216–232. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  21. 21.
    Manson, J., Pugh, W., Adve, S.: The Java memory model. In: POPL 2005, pp. 378–391. ACM (2005)Google Scholar
  22. 22.
    Nipkow, T., Paulson, L.C., Wenzel, M.T.: Isabelle/HOL — A Proof Assistant for Higher-Order Logic. LNCS, vol. 2283. Springer, Heidelberg (2002)MATHGoogle Scholar
  23. 23.
    Causality test cases for the Java memory model, http://www.cs.umd.edu/~pugh/java/memoryModel/CausalityTestCases.html
  24. 24.
    Pugh, W.: The Java memory model is fatally flawed. Concurrency: Practice and Experience 12, 445–455 (2000)CrossRefGoogle Scholar
  25. 25.
  26. 26.
    Ševčík, J., Aspinall, D.: On Validity of Program Transformations in the Java Memory Model. In: Ryan, M. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 27–51. Springer, Heidelberg (2008)CrossRefGoogle Scholar
  27. 27.
    Ševčík, J., Vafeiadis, V., Nardelli, F., Jagannathan, S., Sewell, P.: Relaxed-memory concurrency and verified compilation. In: POPL 2011. pp. 43–54. ACM (2011)Google Scholar
  28. 28.
    Sewell, P., Sarkar, S., Owens, S., Nardelli, F.Z., Myreen, M.O.: x86-TSO: a rigorous and usable programmer’s model for x86 multiprocessors. Commun. ACM 53, 89–97 (2010)CrossRefGoogle Scholar
  29. 29.
    Torlak, E., Vaziri, M., Dolby, J.: MemSAT: checking axiomatic specifications of memory models. In: PLDI 2010. pp. 341–350. ACM (2010)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Andreas Lochbihler
    • 1
  1. 1.Karlsruher Institut für TechnologieGermany

Personalised recommendations