skip to main content
research-article
Open Access

Synthesizing fine-grained synchronization protocols for implicit monitors

Published:29 April 2022Publication History
Skip Abstract Section

Abstract

A monitor is a widely-used concurrent programming abstraction that encapsulates all shared state between threads. Monitors can be classified as being either implicit or explicit depending on the primitives they provide. Implicit monitors are much easier to program but typically not as efficient. To address this gap, there has been recent research on automatically synthesizing explicit-signal monitors from an implicit specification, but prior work does not exploit all paralellization opportunities due to the use of a single lock for the entire monitor. This paper presents a new technique for synthesizing fine-grained explicit-synchronization protocols from implicit monitors. Our method is based on two key innovations: First, we present a new static analysis for inferring safe interleavings that allow violating mutual exclusion of monitor operations without changing its semantics. Second, we use the results of this static analysis to generate a MaxSAT instance whose models correspond to correct-by-construction synchronization protocols. We have implemented our approach in a tool called Cortado and evaluate it on monitors that contain parallelization opportunities. Our evaluation shows that Cortado can synthesize synchronization policies that are competitive with, or even better than, expert-written ones on these benchmarks.

References

  1. Noga Alon. 1986. Covering graphs by the minimum number of equivalence relations. Combinatorica, 6, 3 (1986), Sep, 201–206. issn:1439-6912 https://doi.org/10.1007/BF02579381 Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Andrew D Birrell. 1989. An introduction to programming with threads. Digital Systems Research Center, Palo Alto, California.Google ScholarGoogle Scholar
  3. Peter A. Buhr, Michel Fortier, and Michael H. Coffin. 1995. Monitor Classification. ACM Comput. Surv., 27, 1 (1995), mar, 63–107. issn:0360-0300 https://doi.org/10.1145/214037.214100 Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Sigmund Cherem, Trishul Chilimbi, and Sumit Gulwani. 2008. Inferring Locks for Atomic Sections. SIGPLAN Not., 43, 6 (2008), jun, 304–315. issn:0362-1340 https://doi.org/10.1145/1379022.1375619 Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Leonardo de Moura and Nikolaj Bjørner. 2008. Z3: An Efficient SMT Solver. In Tools and Algorithms for the Construction and Analysis of Systems, C. R. Ramakrishnan and Jakob Rehof (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg. 337–340. isbn:978-3-540-78800-3Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Michael Emmi, Jeffrey S. Fischer, Ranjit Jhala, and Rupak Majumdar. 2007. Lock allocation. In Proceedings of the 34th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2007, Nice, France, January 17-19, 2007. Association for Computing Machinery, New York, NY, USA. 291–296. https://doi.org/10.1145/1190216.1190260 Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Kostas Ferles, Benjamin Sepanski, Rahul Krishnan, James Bornholt, and Isil Dillig. 2022. Synthesizing Fine-Grained Synchronization Protocols for Implicit Monitors (Extended Version). arxiv:2203.00783.Google ScholarGoogle Scholar
  8. Kostas Ferles, Jacob Van Geffen, Isil Dillig, and Yannis Smaragdakis. 2018. Symbolic Reasoning for Automatic Signal Placement. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2018). Association for Computing Machinery, New York, NY, USA. 120–134. isbn:9781450356985 https://doi.org/10.1145/3192366.3192395 Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. GitHub. 2022. GitHub REST API. https://docs.github.com/en/restGoogle ScholarGoogle Scholar
  10. Guy Golan-Gueta, Nathan Bronson, Alex Aiken, G. Ramalingam, Mooly Sagiv, and Eran Yahav. 2011. Automatic Fine-Grain Locking Using Shape Properties. SIGPLAN Not., 46, 10 (2011), oct, 225–242. issn:0362-1340 https://doi.org/10.1145/2076021.2048086 Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Arie Gurfinkel, Temesghen Kahsai, and Jorge A. Navas. 2015. SeaHorn: A Framework for Verifying C Programs Competition Contribution. In Proceedings of the 21st International Conference on Tools and Algorithms for the Construction and Analysis of Systems - Volume 9035. Springer-Verlag, Berlin, Heidelberg. 447–450. isbn:9783662466803 https://doi.org/10.1007/978-3-662-46681-0_41 Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Richard L. Halpert, Christopher J. F. Pickett, and Clark Verbrugge. 2007. Component-Based Lock Allocation. In Proceedings of the 16th International Conference on Parallel Architecture and Compilation Techniques (PACT ’07). IEEE Computer Society, USA. 353–364. isbn:0769529445Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Per Brinch Hansen. 1973. Operating System Principles. Prentice-Hall, Englewood Cliffs, New Jersey. isbn:0-13-637843-9Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Michael Hicks, Jeffrey S Foster, and Polyvios Pratikakis. 2006. Lock inference for atomic sections. In On-Line Proceedings of the First ACM SIGPLAN Workshop on Languages, Compilers, and Hardware Support for Transactional Computing (TRANSACT). http://www.cs.purdue.edu/homes/jv/events/TRANSACT/transact-06.tgzGoogle ScholarGoogle Scholar
  15. C. A. R. Hoare. 1971. Towards a theory of parallel programming. In Operating Systems Techniques, Proceedings of a Seminar at Queen’s University, Belfast. Springer-Verlag, Belfast, Northern Ireland. 231–244. isbn:0387954015Google ScholarGoogle Scholar
  16. C. A. R. Hoare. 1974. Monitors: An Operating System Structuring Concept. Commun. ACM, 17, 10 (1974), oct, 549–557. issn:0001-0782 https://doi.org/10.1145/355620.361161 Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Wei-Lun Hung and Vijay K. Garg. 2013. AutoSynch: An Automatic-Signal Monitor Based on Predicate Tagging. SIGPLAN Not., 48, 6 (2013), jun, 253–262. issn:0362-1340 https://doi.org/10.1145/2499370.2462175 Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Butler W. Lampson and David D. Redell. 1980. Experience with Processes and Monitors in Mesa. Commun. ACM, 23, 2 (1980), feb, 105–117. issn:0001-0782 https://doi.org/10.1145/358818.358824 Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. William Landi and Barbara G. Ryder. 1992. A Safe Approximate Algorithm for Interprocedural Aliasing. SIGPLAN Not., 27, 7 (1992), July, 235–248. issn:0362-1340 https://doi.org/10.1145/143103.143137 Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Richard J. Lipton. 1975. Reduction: A Method of Proving Properties of Parallel Programs. Commun. ACM, 18, 12 (1975), dec, 717–721. issn:0001-0782 https://doi.org/10.1145/361227.361234 Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Bill McCloskey, Feng Zhou, David Gay, and Eric Brewer. 2006. Autolocker: Synchronization Inference for Atomic Sections. In Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL ’06). Association for Computing Machinery, New York, NY, USA. 346–358. isbn:1595930272 https://doi.org/10.1145/1111037.1111068 Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. T. S. Michael and Thomas Quint. 2006. Sphericity, Cubicity, and Edge Clique Covers of Graphs. Discrete Appl. Math., 154, 8 (2006), may, 1309–1313. issn:0166-218XGoogle ScholarGoogle Scholar
  23. Aleksey Shipilev, Sergey Kuksenko, Astrand Astrand, Staffan Freiberg, and Henrik Loef. 2021. OpenJDK: jmh. http://openjdk.java.net/projects/code-tools/jmh/Google ScholarGoogle Scholar
  24. Raja Vallée-Rai, Phong Co, Etienne Gagnon, Laurie Hendren, Patrick Lam, and Vijay Sundaresan. 1999. Soot-a Java bytecode optimization framework. In Proceedings of the 1999 conference of the Centre for Advanced Studies on Collaborative research. IBM Press, Mississauga, Ontario, Canada. 13.Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Synthesizing fine-grained synchronization protocols for implicit monitors

      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

      • Article Metrics

        • Downloads (Last 12 months)123
        • Downloads (Last 6 weeks)4

        Other Metrics

      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!