Semantics for Locking Specifications

  • Michael D. Ernst
  • Damiano Macedonio
  • Massimo MerroEmail author
  • Fausto Spoto
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 9690)


Lock-based synchronization disciplines, like Java’s @GuardedBy, are widely used to prevent concurrency errors. However, their semantics is often expressed informally and is consequently ambiguous. This article highlights such ambiguities and overcomes them by formalizing two possible semantics of @GuardedBy, using a reference operational semantics for a core calculus of a concurrent Java-like language. It also identifies when such annotations are actual guarantees against data races. Our work aids in understanding the annotations and supports the development of sound tools that verify or infer them.


Mutual Exclusion Program Point Data Race Type Annotation Structural Operational Semantic 
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.



We thank Ruggero Lanotte for valuable comments on an early draft. This material is based on research sponsored by DARPA under agreement numbers FA8750-12-2-0107, FA8750-15-C-0010, and FA8750-16-2-0032.


  1. 1.
    Abadi, M., Flanagan, C., Freund, S.: Types for safe locking: static race detection for Java. ACM TOPLAS 28(2), 207–255 (2006)CrossRefGoogle Scholar
  2. 2.
    Ábrahám-Mumm, E., de Boer, F.S., de Roever, W.-P., Steffen, M.: Verification for java’s reentrant multithreading concept. In: Nielsen, M., Engberg, U. (eds.) FOSSACS 2002. LNCS, vol. 2303, pp. 5–20. Springer, Heidelberg (2002)CrossRefGoogle Scholar
  3. 3.
    Bandera: About Bandera.
  4. 4.
    Bierman, G.M., Parkinson, M.J.: Effects and effect inference for a core java calculus. ENTCS 82(7), 82–107 (2003)Google Scholar
  5. 5.
    Blanchet, B.: Escape analysis for java: theory and practice. ACM TOPLAS 25(6), 713–775 (2003)CrossRefGoogle Scholar
  6. 6.
    Bogdanas, D., Rosu, G.: K-java: a complete semantics of java. In: ACM SIGPLAN-SIGACT POPL, pp. 445–456, Mumbai, India (2015)Google Scholar
  7. 7.
    Cenciarelli, P., Knapp, A., Reus, B., Wirsing, M.: From sequential to multi-threaded java: an event-based operational semantics. In: Johnson, M. (ed.) AMAST 1997. LNCS, vol. 1349, pp. 75–90. Springer, Heidelberg (1997)CrossRefGoogle Scholar
  8. 8.
    Dietl, W., Dietzel, S., Ernst, M.D., Muslu, K., Schiller, T.W.: Building and using pluggable type-checkers. In: Taylor, R.N., Gall, H.C. (eds.) ICSE 2011 (2011)Google Scholar
  9. 9.
    Ernst, M.D., Macedonio, D., Merro, M., Spoto, F.: Semantics for locking specifications. CoRR abs/1501.05338 (2015)Google Scholar
  10. 10.
    Ernst, M., Lovato, A., Macedonio, D., Spoto, F., Thaine, J.: Locking discipline inference and checking. In: ICSE 2016, Austin, TX, USA (2016)Google Scholar
  11. 11.
    Goetz, B., Peierls, T., Bloch, J., Bowbeer, J.: Java Concurrency in Practice. Addison Wesley, Boston (2006)Google Scholar
  12. 12.
    Google: Guava: Google Core Libraries for Java 1.6+.
  13. 13.
    Hatcliff, J., Dwyer, M.B.: Using the bandera tool set to model-check properties of concurrent java software. In: Larsen, K.G., Nielsen, M. (eds.) CONCUR 2001. LNCS, vol. 2154, p. 39. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  14. 14.
    Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight java: a minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)CrossRefGoogle Scholar
  15. 15.
  16. 16.
    Julia, S.: The Julia Static Analyzer.
  17. 17.
    Long, B., Long, B.W.: Formal specification of java concurrency to assist software verification. In: Dongarra, J. (ed.) IPDPS 2003. IEEE Computer Society (2003)Google Scholar
  18. 18.
  19. 19.
    Nikolić, D.J., Spoto, F.: Definite expression aliasing analysis for java bytecode. In: Roychoudhury, A., D’Souza, M. (eds.) ICTAC 2012. LNCS, vol. 7521, pp. 74–89. Springer, Heidelberg (2012)CrossRefGoogle Scholar
  20. 20.
    Östlund, J., Wrigstad, T.: Welterweight java. In: Vitek, J. (ed.) TOOLS 2010. LNCS, vol. 6141, pp. 97–116. Springer, Heidelberg (2010)CrossRefGoogle Scholar
  21. 21.
    Palsberg, J., Schwartzbach, M.I.: Object-oriented type inference. In: Paepcke, A. (ed.) OOPSLA 1991, pp. 146–161. ACM SIGPLAN Notices, ACM, New York (1991)Google Scholar
  22. 22.
    Pech, V.: Concurrency is hot, try the JCIP annotations (2010).

Copyright information

© Springer International Publishing Switzerland 2016

Authors and Affiliations

  • Michael D. Ernst
    • 1
  • Damiano Macedonio
    • 2
  • Massimo Merro
    • 2
    Email author
  • Fausto Spoto
    • 2
  1. 1.Computer Science and EngineeringUniversity of WashingtonSeattleUSA
  2. 2.Dipartimento di InformaticaUniversità degli Studi di VeronaVeronaItaly

Personalised recommendations