Abstract
Despite decades of research, we do not have a satisfactory concurrency semantics for any general-purpose programming language that aims to support concurrent systems code. The Java Memory Model has been shown to be unsound with respect to standard compiler optimisations, while the C/C++11 model is too weak, admitting undesirable thin-air executions.
Our goal in this paper is to articulate this major open problem as clearly as is currently possible, showing how it arises from the combination of multiprocessor relaxed-memory behaviour and the desire to accommodate current compiler optimisations. We make several novel contributions that each shed some light on the problem, constraining the possible solutions and identifying new difficulties.
First we give a positive result, proving in HOL4 that the existing axiomatic model for C/C++11 guarantees sequentially consistent semantics for simple race-free programs that do not use low-level atomics (DRF-SC, one of the core design goals). We then describe the thin-air problem and show that it cannot be solved, without restricting current compiler optimisations, using any per-candidate-execution condition in the style of the C/C++11 model. Thin-air executions were thought to be confined to programs using relaxed atomics, but we further show that they recur when one attempts to integrate the concurrency model with more of C, mixing atomic and nonatomic accesses, and that also breaks the DRF-SC result. We then describe a semantics based on an explicit operational construction of out-of-order execution, giving the desired behaviour for thin-air examples but exposing further difficulties with accommodating existing compiler optimisations. Finally, we show that there are major difficulties integrating concurrency semantics with the C/C++ notion of undefined behaviour.
We hope thereby to stimulate and enable research on this key issue.
Chapter PDF
Similar content being viewed by others
Keywords
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
The SPARC architecture manual, v. 9, http://www.sparc.org/technical-documents/ , http://www.dev
Programming Languages — C (2011), ISO/IEC 9899:2011, http://www.open-std.org/jtc1/sc22/wg14/docs/n1539.pdf
Adve, S.V., Hill, M.D.: Weak ordering — a new definition. In: ISCA (1990)
Alglave, J., Maranget, L., Tautschnig, M.: Herding cats: Modelling, simulation, testing, and data mining for weak memory. ACM TOPLAS, 36(2) (2014)
Batty, M.: The C11 and C++11 concurrency model. PhD thesis, University of Cambridge (2014), http://www.cl.cam.ac.uk/~mjb220/battythesis.pdf
Batty, M., Dodds, M., Gotsman, A.: Library abstraction for C/C++ concurrency. In: Proc. POPL (2013)
Batty, M., Memarian, K., Owens, S., Sarkar, S., Sewell, P.: Clarifying and compiling C/C++ concurrency: from C++11 to POWER. In: Proc. POPL (2012)
Batty, M., Owens, S., Sarkar, S., Sewell, P., Weber, T.: Mathematizing C++ concurrency. In: Proc. POPL (2011)
Becker, P. (ed.): Programming Languages — C++ (2011), ISO/IEC 14882:2011, http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf
Boehm, H.-J.: Threads cannot be implemented as a library. In: Proc. PLDI (2005)
Boehm, H.-J.: Memory model rationales (March 2007), http://open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2176.html
Boehm, H.-J.: N3786: Prohibiting “out of thin air” results in C++14 (September 2013), http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n3786.htm
Boehm, H.-J., Adve, S.V.: Foundations of the C++ concurrency memory model. In: Proc. PLDI (2008)
Boehm, H.-J., Demsky, B.: Outlawing ghosts: Avoiding out-of-thin-air results. In: Proc. MSPC (2014)
Boudol, G., Petri, G.: A theory of speculative computation. In: Gordon, A.D. (ed.) ESOP 2010. LNCS, vol. 6012, pp. 165–184. Springer, Heidelberg (2010)
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)
Demange, D., Laporte, V., Zhao, L., Jagannathan, S., Pichardie, D., Vitek, J.: Plan B: A buffered memory model for Java. In: POPL (2013)
Free Software Foundation, Inc., RTL Passes — GNU Compiler Collection (GCC) Internals (October 2014), https://gcc.gnu.org/onlinedocs/gccint/RTL-passes.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, 399–407 (1992)
Gosling, J., Joy, B., Steele, G.: The Java Language Specification (1996)
The HOL 4 system, http://hol.sourceforge.net/
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)
Lamport, L.: How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comput. C-28(9), 690–691 (1979)
LLVM Project. LLVM’s Analysis and Transform Passes — LLVM 3.6 documentation (October 2014), http://llvm.org/docs/Passes.html
Manson, J., Pugh, W., Adve, S.V.: The Java memory model. In: POPL (2005)
Maranget, L., Sarkar, S., Sewell, P.: A tutorial introduction to the ARM and POWER relaxed memory models (October 2012), http://www.cl.cam.ac.uk/~pes20/ppc-supplemental/test7.pdf
Marino, D., Singh, A., Millstein, T., Musuvathi, M., Narayanasamy, S.: A case for an SC-preserving compiler. In: PLDI (2011)
McKenney, P.: Reordering and verification at the linux kernel reorder workshop in vienna summer of logic. In: Invited talk at REORDER Workshop, Vienna Summer of Logic (July 2014), http://www2.rdrop.com/users/paulmck/scalability/paper/LinuxRCUVerif.2014.07.17a.pdf
Morisset, F.R., Pawan, P., Nardelli, Z.: Compiler testing via a theory of sound optimisations in the C11/C++11 memory model. In: Proc. PLDI (2013)
Norris, B., Demsky, B.: CDSchecker: Checking concurrent data structures written with C/C++ atomics. In: Proc. OOPSLA (2013)
Pugh, W.: Fixing the Java memory model. In: Proc. ACM 1999 Conference on Java Grande (1999)
Sarkar, S., Memarian, K., Owens, S., Batty, M., Sewell, P., Maranget, L., Alglave, J., Williams, D.: Synchronising C/C++ and POWER. In: Proc. PLDI (2012)
Sarkar, S., Sewell, P., Alglave, J., Maranget, L., Williams, D.: Understanding POWER multiprocessors. In: Proc. PLDI (2011)
Ševčík, J., Aspinall, D.: On Validity of Program Transformations in the Java Memory Model. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 27–51. Springer, Heidelberg (2008)
Sewell, P., Sarkar, S., Owens, S., Zappa Nardelli, F., Myreen, M.O.: x86-TSO: A rigorous and usable programmer’s model for x86 multiprocessors. C. ACM 53(7), 89–97 (2010), (Research Highlights)
Singh, A., Narayanasamy, S., Marino, D., Millstein, T., Musuvathi, M.: End-to-end sequential consistency. In: Proc. ISCA (2012)
Turon, A., Vafeiadis, V., Dreyer, D.: GPS: Navigating weak memory with ghosts, protocols, and separation. In: Proc. OOPSLA (2014)
Vafeiadis, V., Balabonski, T., Chakraborty, S., Morisset, R., Zappa Nardelli, F.: Common compiler optimisations are invalid in the C11 memory model and what we can do about it. In: Proc. POPL (2015)
Vafeiadis, V., Narayan, C.: Relaxed separation logic: A program logic for C11 concurrency. In: Proc. OOPSLA (2013)
Ševčík, J.: Safe optimisations for shared-memory concurrent programs. In: PLDI (2011)
Ševčík, J., Vafeiadis, V., Zappa Nardelli, F., Jagannathan, S., Sewell, P.: CompCertTSO: A verified compiler for relaxed-memory concurrency. J. ACM 60, 22:1–22:50 (2013)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Batty, M., Memarian, K., Nienhuis, K., Pichon-Pharabod, J., Sewell, P. (2015). The Problem of Programming Language Concurrency Semantics. In: Vitek, J. (eds) Programming Languages and Systems. ESOP 2015. Lecture Notes in Computer Science(), vol 9032. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-662-46669-8_12
Download citation
DOI: https://doi.org/10.1007/978-3-662-46669-8_12
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-662-46668-1
Online ISBN: 978-3-662-46669-8
eBook Packages: Computer ScienceComputer Science (R0)