Abstract
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.
Partially funded by Joint Project 2011 “Statical Analysis for Multithreading”.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Abadi, M., Flanagan, C., Freund, S.: Types for safe locking: static race detection for Java. ACM TOPLAS 28(2), 207–255 (2006)
Á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)
Bandera: About Bandera. http://bandera.projects.cis.ksu.edu
Bierman, G.M., Parkinson, M.J.: Effects and effect inference for a core java calculus. ENTCS 82(7), 82–107 (2003)
Blanchet, B.: Escape analysis for java: theory and practice. ACM TOPLAS 25(6), 713–775 (2003)
Bogdanas, D., Rosu, G.: K-java: a complete semantics of java. In: ACM SIGPLAN-SIGACT POPL, pp. 445–456, Mumbai, India (2015)
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)
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)
Ernst, M.D., Macedonio, D., Merro, M., Spoto, F.: Semantics for locking specifications. CoRR abs/1501.05338 (2015)
Ernst, M., Lovato, A., Macedonio, D., Spoto, F., Thaine, J.: Locking discipline inference and checking. In: ICSE 2016, Austin, TX, USA (2016)
Goetz, B., Peierls, T., Bloch, J., Bowbeer, J.: Java Concurrency in Practice. Addison Wesley, Boston (2006)
Google: Guava: Google Core Libraries for Java 1.6+. https://code.google.com/p/guava-libraries
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)
Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight java: a minimal core calculus for Java and GJ. ACM TOPLAS 23(3), 396–450 (2001)
Javadoc for @GuardedBy. https://jsr-305.googlecode.com/svn/trunk/javadoc/javax/annotation/concurrent/GuardedBy.html
Julia, S.: The Julia Static Analyzer. http://www.juliasoft.com/julia
Long, B., Long, B.W.: Formal specification of java concurrency to assist software verification. In: Dongarra, J. (ed.) IPDPS 2003. IEEE Computer Society (2003)
NASA: Java PathFinder. http://babelfish.arc.nasa.gov/trac/jpf
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)
Östlund, J., Wrigstad, T.: Welterweight java. In: Vitek, J. (ed.) TOOLS 2010. LNCS, vol. 6141, pp. 97–116. Springer, Heidelberg (2010)
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)
Pech, V.: Concurrency is hot, try the JCIP annotations (2010). http://jetbrains.dzone.com/tips/concurrency-hot-try-jcip
Acknowledgments
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.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2016 Springer International Publishing Switzerland
About this paper
Cite this paper
Ernst, M.D., Macedonio, D., Merro, M., Spoto, F. (2016). Semantics for Locking Specifications. In: Rayadurgam, S., Tkachuk, O. (eds) NASA Formal Methods. NFM 2016. Lecture Notes in Computer Science(), vol 9690. Springer, Cham. https://doi.org/10.1007/978-3-319-40648-0_27
Download citation
DOI: https://doi.org/10.1007/978-3-319-40648-0_27
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-40647-3
Online ISBN: 978-3-319-40648-0
eBook Packages: Computer ScienceComputer Science (R0)