Abstract
Eliminating so-called “out-of-thin-air” (OOTA) results is an open problem with many existing programming language memory models including Java, C, and C++. OOTA behaviors are problematic in that they break both formal and informal modular reasoning about program behavior. Defining memory model semantics that are easily understood, allow existing optimizations, and forbid OOTA results remains an open problem. This paper explores two simple solutions to this problem that forbid OOTA results. One solution is targeted towards C/C++-like memory models in which racing operations are explicitly labeled as atomic operations and a second solution is targeted towards Java-like languages in which all memory operations may create OOTA executions. Our solutions provide a per-candidate execution criterion that makes it possible to examine a single execution and determine whether the memory model permits the execution. We implemented and evaluated both solutions in the LLVM compiler framework. Our results show that on an ARMv8 processor the first solution has no overhead on average and a maximum overhead of 6.3% on 43 concurrent data structures, and that the second solution has an average overhead of 3.1% and a maximum overhead of 17.6% on the SPEC CPU2006 C/C++ benchmarks.
Supplemental Material
- Sarita V. Adve and Mark D. Hill. 1990. Weak Ordering - A New Definition. In Proceedings of the 17th Annual International Symposium on Computer Architecture. Google Scholar
Digital Library
- Jade Alglave, Luc Maranget, Paul E McKenney, Andrea Parri, and Alan Stern. 2018. Frightening Small Children and Disconcerting Grown-ups: Concurrency in the Linux Kernel. In 23rd International Conference on Architectural Support for Programming Languages and Operating Systems. Google Scholar
Digital Library
- Azul. 2017. https://www.azul.com/press_release/falcon- jit- compiler/ .Google Scholar
- Mark Batty, Mike Dodds, and Alexey Gotsman. 2013. Library Abstraction for C/C++ Concurrency. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Mark Batty, Kayvan Memarian, Kyndylan Nienhuis, Jean Pichon-Pharabod, and Peter Sewell. 2015a. The Problem of Programming Language Concurrency Semantics. In Proceedings of the 2015 European Symposium on Programming.Google Scholar
Cross Ref
- Mark Batty, Kayvan Memarian, Kyndylan Nienhuis, Jean Pichon-Pharabod, and Peter Sewell. 2015b. The Problem of Programming Language Concurrency Semantics. In Proceedings of the 24th European Symposium on Programming.Google Scholar
Cross Ref
- Mark Batty, Scott Owens, Susmit Sarkar, Peter Sewell, and Tjark Weber. 2011. Mathematizing C++ Concurrency. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Pete Becker. 2011. ISO/IEC 14882:2011, Information Technology – Programming Languages – C++.Google Scholar
- Hans Boehm and Brian Demsky. 2014. Outlawing Ghosts: Avoiding Out-of-Thin-Air Results. In Proceedings of the 2014 ACM SIGPLAN Workshop on Memory Systems Performance and Correctness. Google Scholar
Digital Library
- Hans J. Boehm and Sarita V. Adve. 2008. Foundations of the C++ concurrency memory model. In Proceedings of the 2008 ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Matko Botinčan, Paola Glavan, and Davor Runje. 2010. Verification of Causality Requirements in Java Memory Model is Undecidable. In Proceedings of the 8th International Conference on Parallel Processing and Applied Mathematics. Google Scholar
Digital Library
- John Cavazos, Grigori Fursin, Felix Agakov, Edwin Bonilla, Michael FP O’Boyle, and Olivier Temam. 2007. Rapidly Selecting Good Compiler Optimizations Using Performance Counters. In Proceedings of the 5th Annual IEEE/ACM International Symposium on Code Generation and Optimization. Google Scholar
Digital Library
- Pietro Cenciarelli, Alexander Knapp, and Eleonora Sibilio. 2007. The Java Memory Model: Operationally, Denotationally, Axiomatically. In Proceedings of the 2007 European Symposium on Programming. Google Scholar
Digital Library
- Delphine Demange, Vincent Laporte, Lei Zhao, Suresh Jagannathan, David Pichardie, and Jan Vitek. 2013. Plan B: A Buffered Memory Model for Java. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Stephen Dolan, KC Sivaramakrishnan, and Anil Madhavapeddy. 2018. Bounding data races in space and time. In Proceedings of the 2018 ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, 242–255. Google Scholar
Digital Library
- Facebook. 2018. https://github.com/facebook/folly .Google Scholar
- John L Henning. 2006. SPEC CP U2006 Benchmark Descriptions. ACM SIGARCH Computer Architecture News 34, 4 (2006), 1–17. Google Scholar
Digital Library
- Radha Jagadeesan, Corin Pitcher, and James Riely. 2010. Generative Operational Semantics for Relaxed Memory Models. In Proceedings of the 2010 European Symposium on Programming. Google Scholar
Digital Library
- Alan Jeffrey and James Riely. 2016. On Thin Air Reads towards an Event Structures Model of Relaxed Memory. In Proceedings of the 31st Annual ACM/IEEE Symposium on Logic in Computer Science. Google Scholar
Digital Library
- ISO JTC. 2011. ISO/IEC 9899:2011, Information Technology – Programming Languages – C.Google Scholar
- ISO JTC. 2014. ISO/IEC 14882:2014, Information Technology – Programming Languages – C++.Google Scholar
- Jeehoon Kang, Chung-Kil Hur, Ori Lahav, Viktor Vafeiadis, and Derek Dreyer. 2017. A Promising Semantics for RelaxedMemory Concurrency. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Max Khiszinsky. 2017. https://github.com/khizmax/libcds .Google Scholar
- Michalis Kokologiannakis, Ori Lahav, Konstantinos Sagonas, and Viktor Vafeiadis. 2017. Effective Stateless Model Checking for C/C++ Concurrency. In Proceedings of the Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Ori Lahav, Viktor Vafeiadis, Jeehoon Kang, Chung-Kil Hur, and Derek Dreyer. 2017. Repairing Sequential Consistency in C/C++ 11. In Proceedings of the 2017 ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, 618–632. Google Scholar
Digital Library
- Chris Lattner and Vikram Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the International Symposium on Code Generation and Optimization: Feedback-directed and Runtime Optimization. Google Scholar
Digital Library
- Lun Liu, Todd Millstein, and Madanlal Musuvathi. 2017. A Volatile-by-Default JVM for Server Applications. Proceedings of the ACM on Programming Languages 1, OOPSLA (2017), 49. Google Scholar
Digital Library
- Jeremy Manson, William Pugh, and Sarita V. Adve. 2005. The Java Memory Model. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Luc Maranget, Susmit Sarkar, and Peter Sewell. 2012. A Tutorial Introduction to The ARM and POWER Relaxed Memory Models. http://www.cl.cam.ac.uk/~pes20/ppc- supplemental/test7.pdf .Google Scholar
- Daniel Marino, Abhayendra Singh, Todd Millstein, Madanlal Musuvathi, and Satish Narayanasamy. 2011. A Case for an SC-Preserving Compiler. In Proceedings of the 2011 ACM SIGPLAN Conference on Programming Language Design and Implementation. Google Scholar
Digital Library
- Paul E. McKenney, Alan Jeffrey, Ali Sezgin, and Tony Tye. 2016. Out-of-Thin-Air Execution is Vacuous. http://www.open- std. org/jtc1/sc22/wg21/docs/papers/2016/p0422r0.html .Google Scholar
- Yuri Meshman, Noam Rinetzky, and Eran Yahav. 2015. Pattern-based Synthesis of Synchronization for the C++ Memory Model. In Formal Methods in Computer-Aided Design. Google Scholar
Digital Library
- Brian Norris and Brian Demsky. 2013. CDSChecker: Checking Concurrent Data Structures Written with C/C++ Atomics. In Proceeding of the 28th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications. Google Scholar
Digital Library
- Peizhao Ou and Brian Demsky. 2015. AutoMO: Automatic Inference of Memory Order Parameters for C/C++11. In Proceeding of the 30th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications. Google Scholar
Digital Library
- Peizhao Ou and Brian Demsky. 2017. Checking Concurrent Data Structures Under the C/C++11 Memory Model. In Proceedings of the 22nd ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. Google Scholar
Digital Library
- Peizhao Ou and Brian Demsky. 2018. Towards Understanding the Costs of Avoiding Out-of-Thin-Air Results (extended version). http://plrg.eecs.uci.edu/publications/OOTA- Extended- Version.pdf .Google Scholar
- Zhelong Pan and Rudolf Eigenmann. 2006. Fast and Effective Orchestration of Compiler Optimizations for Automatic Performance Tuning. In Proceedings of the 4th Annual IEEE/ACM International Symposium on Code Generation and Optimization. Google Scholar
Digital Library
- Jean Pichon-Pharabod and Peter Sewell. 2016. A Concurrency Semantics for Relaxed Atomics That Permits Optimisation and Avoids Thin-air Executions. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Anton Podkopaev, Ori Lahav, and Viktor Vafeiadis. 2017. Promising Compilation to ARMv8 POP. In Proceedings of the 31st European Conference on Object-Oriented Programming.Google Scholar
- Jeff Preshing. 2018. https://github.com/preshing/junction .Google Scholar
- Christopher Pulte, Shaked Flur, Will Deacon, Jon French, Susmit Sarkar, and Peter Sewell. 2018. Simplifying ARM Concurrency: Multicopy-atomic Axiomatic and Operational Models for ARMv8. In Proceedings of the Symposium on Principles of Programming Languages.Google Scholar
Digital Library
- Erik Rigtorp. 2017a. https://github.com/rigtorp/SPSCQueue .Google Scholar
- Erik Rigtorp. 2017b. https://github.com/rigtorp/MPMCQueue .Google Scholar
- Carl G Ritson and Scott Owens. 2016. Benchmarking Weak Memory Models. In Proceedings of the 21st ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming. Google Scholar
Digital Library
- Barry K Rosen, Mark N Wegman, and F Kenneth Zadeck. 1988. Global Value Numbers and Redundant Computations. In Proceedings of the Symposium on Principles of Programming Languages. Google Scholar
Digital Library
- Jaroslav Ševčík, Viktor Vafeiadis, Francesco Zappa Nardelli, Suresh Jagannathan, and Peter Sewell. 2013. CompCertTSO: A Verified Compiler for Relaxed-memory Concurrency. Journal of the ACM (JACM) 60, 3 (2013), 22. Google Scholar
Digital Library
- Aleksey Shipilëv. 2016a. Java Memory Model Pragmatics. https://shipilev.net/blog/2014/jmm- pragmatics/ .Google Scholar
- Aleksey Shipilëv. 2016b. Java Memory Model Pragmatics. https://shipilev.net/ .Google Scholar
- Matthew D Sinclair, Johnathan Alsop, and Sarita V Adve. 2017. Chasing Away RAts: Semantics and Evaluation for Relaxed Atomics on Heterogeneous Systems. In Proceedings of the 44th Annual International Symposium on Computer Architecture. Google Scholar
Digital Library
- Abhayendra Singh, Satish Narayanasamy, Daniel Marino, Todd Millstein, and Madanlal Musuvathi. 2012. End-to-end Sequential Consistency. In Proceedings of the 39th Annual International Symposium on Computer Architecture. Google Scholar
Digital Library
- Michael J Sullivan. 2017. Low-level Concurrent Programming Using the Relaxed Memory Calculus. Ph.D. Dissertation. Carnegie Mellon University.Google Scholar
- Viktor Vafeiadis and Chinmay Narayan. 2013. Relaxed separation logic: A Program Logic for C11 Concurrency. In Proceeding of the 28th ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications. Google Scholar
Digital Library
- Jaroslav Ševčík and David Aspinall. 2008. On Validity of Program Transformations in the Java Memory Model. In Proceedings of the 22th European Conference on Object-Oriented Programming (ECOOP ’08). Google Scholar
Digital Library
- Yang Zhang and Xinyu Feng. 2016. An Operational Happens-before Memory Model. Frontiers of Computer Science 10, 1 (2016), 54–81. Google Scholar
Digital Library
Index Terms
Towards understanding the costs of avoiding out-of-thin-air results
Recommendations
Dynamic race detection for C++11
POPL '17: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming LanguagesThe intricate rules for memory ordering and synchronisation associated with the C/C++11 memory model mean that data races can be difficult to eliminate from concurrent programs. Dynamic data race analysis can pinpoint races in large and complex ...
Dynamic race detection for C++11
POPL '17The intricate rules for memory ordering and synchronisation associated with the C/C++11 memory model mean that data races can be difficult to eliminate from concurrent programs. Dynamic data race analysis can pinpoint races in large and complex ...
The Superthreaded Processor Architecture
The common single-threaded execution model limits processors to exploiting only the relatively small amount of instruction-level parallelism available in application programs. The superthreaded processor, on the other hand, is a concurrent multithreaded ...






Comments