skip to main content
research-article
Open Access
Artifacts Available / v1.1

The leaky semicolon: compositional semantic dependencies for relaxed-memory concurrency

Published:12 January 2022Publication History
Skip Abstract Section

Abstract

Program logics and semantics tell a pleasant story about sequential composition: when executing (S1;S2), we first execute S1 then S2. To improve performance, however, processors execute instructions out of order, and compilers reorder programs even more dramatically. By design, single-threaded systems cannot observe these reorderings; however, multiple-threaded systems can, making the story considerably less pleasant. A formal attempt to understand the resulting mess is known as a “relaxed memory model.” Prior models either fail to address sequential composition directly, or overly restrict processors and compilers, or permit nonsense thin-air behaviors which are unobservable in practice.

To support sequential composition while targeting modern hardware, we enrich the standard event-based approach with preconditions and families of predicate transformers. When calculating the meaning of (S1; S2), the predicate transformer applied to the precondition of an event e from S2 is chosen based on the set of events in S1 upon which e depends. We apply this approach to two existing memory models.

Skip Supplemental Material Section

Supplemental Material

Auxiliary Presentation Video

5 Minute talk (repaired)

References

  1. Jade Alglave, Will Deacon, Richard Grisenthwaite, Antoine Hacquard, and Luc Maranget. 2021. Armed Cats: Formal Concurrency Modelling at Arm. ACM Trans. Program. Lang. Syst., 43, 2 (2021), Article 8, July, 54 pages. issn:0164-0925 https://doi.org/10.1145/3458926 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Jade Alglave, Luc Maranget, and Michael Tautschnig. 2014. Herding Cats: Modelling, Simulation, Testing, and Data Mining for Weak Memory. ACM Trans. Program. Lang. Syst., 36, 2 (2014), Article 7, July, 74 pages. issn:0164-0925 https://doi.org/10.1145/2627752 Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Mark Batty, Kayvan Memarian, Kyndylan Nienhuis, Jean Pichon-Pharabod, and Peter Sewell. 2015. The Problem of Programming Language Concurrency Semantics. In Programming Languages and Systems - 24th European Symposium on Programming, ESOP 2015, London, UK, April 11-18, 2015. Proceedings, Jan Vitek (Ed.) (Lecture Notes in Computer Science, Vol. 9032). Springer, 283–307. https://doi.org/10.1007/978-3-662-46669-8_12 Google ScholarGoogle ScholarCross RefCross Ref
  4. Mark Batty, Scott Owens, Susmit Sarkar, Peter Sewell, and Tjark Weber. 2011. Mathematizing C++ Concurrency. In Proceedings of the 38th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’11). ACM, New York, NY, USA. 55–66. isbn:978-1-4503-0490-0 https://doi.org/10.1145/1926385.1926394 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Hans-J. Boehm and Brian Demsky. 2014. Outlawing Ghosts: Avoiding Out-of-thin-air Results. In Proceedings of the Workshop on Memory Systems Performance and Correctness (MSPC ’14). ACM, New York, NY, USA. Article 7, 6 pages. isbn:978-1-4503-2917-0 https://doi.org/10.1145/2618128.2618134 Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Stephen D. Brookes. 1996. Full Abstraction for a Shared-Variable Parallel Language. Inf. Comput., 127, 2 (1996), 145–163. https://doi.org/10.1006/inco.1996.0056 Google ScholarGoogle ScholarCross RefCross Ref
  7. Soham Chakraborty and Viktor Vafeiadis. 2019. Grounding thin-air reads with event structures. PACMPL, 3, POPL (2019), 70:1–70:28. https://doi.org/10.1145/3290383 Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Minki Cho, Sung-Hwan Lee, Chung-Kil Hur, and Ori Lahav. 2021. Modular data-race-freedom guarantees in the promising semantics. In PLDI ’21: 42nd ACM SIGPLAN International Conference on Programming Language Design and Implementation, Virtual Event, Canada, June 20-25, 20211, Stephen N. Freund and Eran Yahav (Eds.). ACM, 867–882. https://doi.org/10.1145/3453483.3454082 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Simon Cooksey, Sarah Harris, Mark Batty, Radu Grigore, and Mikolás Janota. 2019. PrideMM: Second Order Model Checking for Memory Consistency Models. In Formal Methods. FM 2019 International Workshops - Porto, Portugal, October 7-11, 2019, Revised Selected Papers, Part II, Emil Sekerinski, Nelma Moreira, José N. Oliveira, Daniel Ratiu, Riccardo Guidotti, Marie Farrell, Matt Luckcuck, Diego Marmsoler, José Campos, Troy Astarte, Laure Gonnord, Antonio Cerone, Luis Couto, Brijesh Dongol, Martin Kutrib, Pedro Monteiro, and David Delmas (Eds.) (Lecture Notes in Computer Science, Vol. 12233). Springer, 507–525. https://doi.org/10.1007/978-3-030-54997-8_31 Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Russ Cox. 2016. Go’s Memory Model. http://nil.csail.mit.edu/6.824/2016/notes/gomem.pdfGoogle ScholarGoogle Scholar
  11. Leonardo Mendonça de Moura and Nikolaj Bjørner. 2008. Z3: An Efficient SMT Solver. In Tools and Algorithms for the Construction and Analysis of Systems, 14th International Conference, TACAS 2008, Held as Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2008, Budapest, Hungary, March 29-April 6, 2008. Proceedings, C. R. Ramakrishnan and Jakob Rehof (Eds.) (Lecture Notes in Computer Science, Vol. 4963). Springer, 337–340. https://doi.org/10.1007/978-3-540-78800-3_24 Google ScholarGoogle ScholarCross RefCross Ref
  12. Edsger W. Dijkstra. 1975. Guarded Commands, Nondeterminacy and Formal Derivation of Programs. Commun. ACM, 18, 8 (1975), 453–457. https://doi.org/10.1145/360933.360975 Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Stephen Dolan, KC Sivaramakrishnan, and Anil Madhavapeddy. 2018. Bounding Data Races in Space and Time. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2018). ACM, New York, NY, USA. 242–255. isbn:978-1-4503-5698-5 https://doi.org/10.1145/3192366.3192421 Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. William Ferreira, Matthew Hennessy, and Alan Jeffrey. 1996. A Theory of Weak Bisimulation for Core CML. In Proceedings of the 1996 ACM SIGPLAN International Conference on Functional Programming, ICFP 1996, Philadelphia, Pennsylvania, USA, May 24-26, 1996, Robert Harper and Richard L. Wexelblat (Eds.). ACM, 201–212. https://doi.org/10.1145/232627.232649 Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Jay L. Gischer. 1988. The equational theory of pomsets. Theoretical Computer Science, 61, 2 (1988), 199–224. issn:0304-3975 https://doi.org/10.1016/0304-3975(88)90124-7 Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. C.A.R. Hoare. 1969. An Axiomatic Basis for Computer Programming. Commun. ACM, 12, 10 (1969), Oct., 576–580. issn:0001-0782 https://doi.org/10.1145/363235.363259 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Radha Jagadeesan, Alan Jeffrey, and James Riely. 2020. Pomsets with preconditions: a simple model of relaxed memory. Proc. ACM Program. Lang., 4, OOPSLA (2020), 194:1–194:30. https://doi.org/10.1145/3428262 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Radha Jagadeesan, Corin Pitcher, and James Riely. 2010. Generative Operational Semantics for Relaxed Memory Models. In Programming Languages and Systems, 19th European Symposium on Programming, ESOP 2010, Paphos, Cyprus, March 20-28, 2010. Proceedings, Andrew D. Gordon (Ed.) (Lecture Notes in Computer Science, Vol. 6012). Springer, 307–326. isbn:978-3-642-11956-9 https://doi.org/10.1007/978-3-642-11957-6_17 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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, LICS ’16, New York, NY, USA, July 5-8, 2016, M. Grohe, E. Koskinen, and N. Shankar (Eds.). ACM, 759–767. isbn:978-1-4503-4391-6 https://doi.org/10.1145/2933575.2934536 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Jeehoon Kang, Chung-Kil Hur, Ori Lahav, Viktor Vafeiadis, and Derek Dreyer. 2017. A promising semantics for relaxed-memory concurrency. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017, Paris, France, January 18-20, 2017, Giuseppe Castagna and Andrew D. Gordon (Eds.). ACM, 175–189. http://dl.acm.org/citation.cfm?id=3009850Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Ryan Kavanagh and Stephen Brookes. 2018. A denotational account of C11-style memory. CoRR, abs/1804.04214 (2018), 13 pages. arxiv:1804.04214. arxiv:1804.04214Google ScholarGoogle Scholar
  22. Ori Lahav, Viktor Vafeiadis, Jeehoon Kang, Chung-Kil Hur, and Derek Dreyer. 2017. Repairing sequential consistency in C/C++11. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2017, Barcelona, Spain, June 18-23, 2017, Albert Cohen and Martin T. Vechev (Eds.). ACM, 618–632. isbn:978-1-4503-4988-8 https://doi.org/10.1145/3062341.3062352 Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Leslie Lamport. 1979. How to Make a Multiprocessor Computer That Correctly Executes Multiprocess Programs. IEEE Trans. Comput., 28, 9 (1979), Sept., 690–691. issn:0018-9340 https://doi.org/10.1109/TC.1979.1675439 Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Juneyoung Lee, Chung-Kil Hur, Ralf Jung, Zhengyang Liu, John Regehr, and Nuno P. Lopes. 2018. Reconciling high-level optimizations and low-level code in LLVM. Proc. ACM Program. Lang., 2, OOPSLA (2018), 125:1–125:28. https://doi.org/10.1145/3276495 Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Juneyoung Lee, Yoonseung Kim, Youngju Song, Chung-Kil Hur, Sanjoy Das, David Majnemer, John Regehr, and Nuno P. Lopes. 2017. Taming undefined behavior in LLVM. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI 2017, Barcelona, Spain, June 18-23, 2017, Albert Cohen and Martin T. Vechev (Eds.). ACM, 633–647. https://doi.org/10.1145/3062341.3062343 Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Sung-Hwan Lee, Minki Cho, Anton Podkopaev, Soham Chakraborty, Chung-Kil Hur, Ori Lahav, and Viktor Vafeiadis. 2020. Promising 2.0: global optimizations in relaxed memory concurrency. In Proceedings of the 41st ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2020, London, UK, June 15-20, 2020, Alastair F. Donaldson and Emina Torlak (Eds.). ACM, 362–376. https://doi.org/10.1145/3385412.3386010 Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Lun Liu, Todd Millstein, and Madanlal Musuvathi. 2019. Accelerating Sequential Consistency for Java with Speculative Compilation. In Proceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2019). ACM, New York, NY, USA. 16–30. isbn:978-1-4503-6712-7 https://doi.org/10.1145/3314221.3314611 Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Lun Liu, Todd Millstein, and Madanlal Musuvathi. 2021. Safe-by-Default Concurrency for Modern Programming Languages. ACM Trans. Program. Lang. Syst., 43, 3 (2021), Article 10, Sept., 50 pages. issn:0164-0925 https://doi.org/10.1145/3462206 Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Jeremy Manson, William Pugh, and Sarita V. Adve. 2005. The Java Memory Model. SIGPLAN Not., 40, 1 (2005), Jan., 378–391. issn:0362-1340 https://doi.org/10.1145/1047659.1040336 Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Daniel Marino, Todd D. Millstein, Madanlal Musuvathi, Satish Narayanasamy, and Abhayendra Singh. 2015. The Silently Shifting Semicolon. In 1st Summit on Advances in Programming Languages, SNAPL 2015, May 3-6, 2015, Asilomar, California, USA, Thomas Ball, Rastislav Bodík, Shriram Krishnamurthi, Benjamin S. Lerner, and Greg Morrisett (Eds.) (LIPIcs, Vol. 32). Schloss Dagstuhl - Leibniz-Zentrum für Informatik, 177–189. https://doi.org/10.4230/LIPIcs.SNAPL.2015.177 Google ScholarGoogle ScholarCross RefCross Ref
  31. Ian A. Mason and Carolyn L. Talcott. 1992. References, Local Variables and Operational Reasoning. In Proceedings of the Seventh Annual Symposium on Logic in Computer Science (LICS ’92), Santa Cruz, California, USA, June 22-25, 1992. IEEE Computer Society, 186–197. https://doi.org/10.1109/LICS.1992.185532 Google ScholarGoogle ScholarCross RefCross Ref
  32. Paul E. McKenney, Alan Jeffrey, Ali Sezgin, and Tony Tye. 2016. Out-of-Thin-Air Execution is vacuous. http://wg21.link/p0422Google ScholarGoogle Scholar
  33. Robin Milner. 1977. Fully Abstract Models of Typed lambda-Calculi. Theor. Comput. Sci., 4, 1 (1977), 1–22. https://doi.org/10.1016/0304-3975(77)90053-6 Google ScholarGoogle ScholarCross RefCross Ref
  34. Peter O’Hearn. 2007. Resources, Concurrency, and Local Reasoning. Theor. Comput. Sci., 375, 1-3 (2007), April, 271–307. issn:0304-3975 https://doi.org/10.1016/j.tcs.2006.12.035 Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Marco Paviotti, Simon Cooksey, Anouk Paradis, Daniel Wright, Scott Owens, and Mark Batty. 2020. Modular Relaxed Dependencies in Weak Memory Concurrency. In Programming Languages and Systems - 29th European Symposium on Programming, ESOP 2020, Dublin, Ireland, April 25-30, 2020, Proceedings, Peter Müller (Ed.) (Lecture Notes in Computer Science, Vol. 12075). Springer, 599–625. https://doi.org/10.1007/978-3-030-44914-8_22 Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’16). ACM, New York, NY, USA. 622–633. isbn:978-1-4503-3549-2 https://doi.org/10.1145/2837614.2837616 Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Gordon D. Plotkin. 1977. LCF Considered as a Programming Language. Theor. Comput. Sci., 5, 3 (1977), 223–255. https://doi.org/10.1016/0304-3975(77)90044-5 Google ScholarGoogle ScholarCross RefCross Ref
  38. Vaughan R. Pratt. 1985. Some Constructions for Order-Theoretic Models of Concurrency. In Logics of Programs, Conference, Brooklyn College, New York, NY, USA, June 17-19, 1985, Proceedings, Rohit Parikh (Ed.) (Lecture Notes in Computer Science, Vol. 193). Springer, 269–283. https://doi.org/10.1007/3-540-15648-8_22 Google ScholarGoogle ScholarCross RefCross Ref
  39. William Pugh. 2004. Causality Test Cases. https://perma.cc/PJT9-XS8ZGoogle ScholarGoogle Scholar
  40. Jaroslav Sevčík. 2008. Program Transformations in Weak Memory Models. Laboratory for Foundations of Computer Science, University of Edinburgh.Google ScholarGoogle Scholar
  41. Jaroslav Sevčík and David Aspinall. 2008. On Validity of Program Transformations in the Java Memory Model. In ECOOP 2008 - Object-Oriented Programming, 22nd European Conference, Paphos, Cyprus, July 7-11, 2008, Proceedings, Jan Vitek (Ed.) (Lecture Notes in Computer Science, Vol. 5142). Springer, 27–51. isbn:978-3-540-70591-8 https://doi.org/10.1007/978-3-540-70592-5_3 Google ScholarGoogle ScholarDigital LibraryDigital Library
  42. Joel Spolsky. 2002. The Law of Leaky Abstractions. https://www.joelonsoftware.com/2002/11/11/the-law-of-leaky-abstractions/Google ScholarGoogle Scholar
  43. Viktor Vafeiadis and Chinmay Narayan. 2013. Relaxed separation logic: a program logic for C11 concurrency. In Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages & Applications, OOPSLA 2013, part of SPLASH 2013, Indianapolis, IN, USA, October 26-31, 2013, Antony L. Hosking, Patrick Th. Eugster, and Cristina V. Lopes (Eds.). ACM, 867–884. https://doi.org/10.1145/2509136.2509532 Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Conrad Watt, Christopher Pulte, Anton Podkopaev, Guillaume Barbier, Stephen Dolan, Shaked Flur, Jean Pichon-Pharabod, and Shu-yu Guo. 2020. Repairing and mechanising the JavaScript relaxed memory model. In Proceedings of the 41st ACM SIGPLAN International Conference on Programming Language Design and Implementation, PLDI 2020, London, UK, June 15-20, 2020, Alastair F. Donaldson and Emina Torlak (Eds.). ACM, 346–361. https://doi.org/10.1145/3385412.3385973 Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Conrad Watt, Andreas Rossberg, and Jean Pichon-Pharabod. 2019. Weakening WebAssembly. Proc. ACM Program. Lang., 3, OOPSLA (2019), 133:1–133:28. https://doi.org/10.1145/3360559 Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. The leaky semicolon: compositional semantic dependencies for relaxed-memory concurrency

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!