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.
- 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 Scholar
Digital Library
- Andrew D Birrell. 1989. An introduction to programming with threads. Digital Systems Research Center, Palo Alto, California.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- GitHub. 2022. GitHub REST API. https://docs.github.com/en/restGoogle Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Per Brinch Hansen. 1973. Operating System Principles. Prentice-Hall, Englewood Cliffs, New Jersey. isbn:0-13-637843-9Google Scholar
Digital Library
- 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 Scholar
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- Aleksey Shipilev, Sergey Kuksenko, Astrand Astrand, Staffan Freiberg, and Henrik Loef. 2021. OpenJDK: jmh. http://openjdk.java.net/projects/code-tools/jmh/Google Scholar
- 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 Scholar
Digital Library
Index Terms
Synthesizing fine-grained synchronization protocols for implicit monitors
Recommendations
Symbolic reasoning for automatic signal placement
PLDI '18Explicit signaling between threads is a perennial cause of bugs in concurrent programs. While there are several run-time techniques to automatically notify threads upon the availability of some shared resource, such techniques are not widely-adopted due ...
Symbolic reasoning for automatic signal placement
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and ImplementationExplicit signaling between threads is a perennial cause of bugs in concurrent programs. While there are several run-time techniques to automatically notify threads upon the availability of some shared resource, such techniques are not widely-adopted due ...
Implicit-signal monitors
An implicit (automatic) signal monitor uses a waituntil predicate statement to construct synchronization, as opposed to an explicit-signal monitor using condition variables and signal/wait statements for synchronization. Of the two synchronization ...






Comments