Hostname: page-component-5c6d5d7d68-sv6ng Total loading time: 0 Render date: 2024-08-16T12:12:36.071Z Has data issue: false hasContentIssue false

Locksynth: Deriving Synchronization Code for Concurrent Data Structures with ASP

Published online by Cambridge University Press:  01 September 2023

SARAT CHANDRA VARANASI
Affiliation:
General Electric Research, NY, USA (e-mail: saratchandra.varanasi@ge.com)
NEERAJ MITTAL
Affiliation:
The University of Texas at Dallas, Richardson, TX 75080, USA (e-mails: neerajm@utdallas.edu, gupta@utdallas.edu)
GOPAL GUPTA
Affiliation:
The University of Texas at Dallas, Richardson, TX 75080, USA (e-mails: neerajm@utdallas.edu, gupta@utdallas.edu)

Abstract

We present Locksynth, a tool that automatically derives synchronization needed for destructive updates to concurrent data structures that involve a constant number of shared heap memory write operations. Locksynth serves as the implementation of our prior work on deriving abstract synchronization code. Designing concurrent data structures involves inferring correct synchronization code starting with a prior understanding of the sequential data structure’s operations. Further, an understanding of shared memory model and the synchronization primitives is also required. The reasoning involved transforming a sequential data structure into its concurrent version can be performed using Answer Set Programming, and we mechanized our approach in previous work. The reasoning involves deduction and abduction that can be succinctly modeled in ASP. We assume that the abstract sequential code of the data structure’s operations is provided, alongside axioms that describe concurrent behavior. This information is used to automatically derive concurrent code for that data structure, such as dictionary operations for linked lists and binary search trees that involve a constant number of destructive update operations. We also are able to infer the correct set of locks (but not code synthesis) for external height-balanced binary search trees that involve left/right tree rotations. Locksynth performs the analyses required to infer correct sets of locks and as a final step, also derives the C++ synchronization code for the synthesized data structures. We also provide a performance analysis of the C++ code synthesized by Locksynth with the hand-crafted versions available from the Synchrobench microbenchmark suite. To the best of our knowledge, our tool is the first to employ ASP as a backend reasoner to perform concurrent data structure synthesis.

Type
Original Article
Copyright
© The Author(s), 2023. Published by Cambridge University Press

Access options

Get access to the full version of this content by using one of the access options below. (Log in options will check for institutional or personal access. Content may require purchase if you do not have access.)

References

Arbel, M. and Attiya, H. 2014. Concurrent updates with rcu: Search tree as an example. In Proceedings of The 2014 ACM Symposium on Principles of Distributed Computing, 196–205.Google Scholar
Arias, J. 2019. Advanced Evaluation Techniques for (Non)-Monotonic Reasoning Using Rules with Constraints. Ph.D. thesis, Technical University of Madrid, Spain. URL: https://oa.upm.es/58189/.Google Scholar
Arias, J., Carro, M., Chen, Z. and Gupta, G. 2022. Modeling and rea- soning in event calculus using goal-directed constraint answer set programming. Theory and Practice of Logic Programming 22, 1, 5180.10.1017/S1471068421000156CrossRefGoogle Scholar
Arias, J., Carro, M. and Gupta, G. 2022. Towards dynamic consistency checking in goal-directed predicate answer set programming. In Practical Aspects of Declarative Languages: 24th International Symposium, PADL 2022, Philadelphia, PA, USA, January 17–18, 2022, Proceedings, 117–134.Google Scholar
Arias, J., Carro, M., Salazar, E., Marple, K. and Gupta, G. 2018. Constraint answer set programming without grounding. Theory and Practice of Logic Programming 18, 3–4, 337354.10.1017/S1471068418000285CrossRefGoogle Scholar
Boehm, H.-J. and Adve, S. V. 2008. Foundations of the C++ concurrency memory model. ACM SIGPLAN Notices 43, 6, 6878.10.1145/1379022.1375591CrossRefGoogle Scholar
Brookes, S. and O’Hearn, P. W. 2016. Concurrent separation logic. ACM SIGLOG News 3, 3, 4765.10.1145/2984450.2984457CrossRefGoogle Scholar
Clarke, E. M. and Emerson, E. A. 1981. Design and synthesis of synchronization skeletons using branching time temporal logic. In Workshop on Logic of Programs, Springer, 52–71.Google Scholar
Distefano, D., O’Hearn, P.W. and Yang, H. 2006. A local shape analysis based on separation logic. In Proc. TACAS, Hermanns, H. and Palsberg, J., Eds. LNCS, vol. 3920, Springer, 287–302.Google Scholar
Emerson, E. A. and Kahlon, V. 2000. Reducing model checking of the many to the few. In International Conference on Automated Deduction, Springer, 236–254. doi: 10.1007/10721959_19.CrossRefGoogle Scholar
Gebser, M., Kaminski, R., Kaufmann, B., Lühne, P., Obermeier, P., Ostrowski, M., Romero, J., Schaub, T., Schellhorn, S. and Wanko, P. 2018. The potsdam answer set solving collection 5.0. KI-Künstliche Intelligenz 32, 181–182.Google Scholar
Gelfond, M. and Kahl, Y. 2014. Knowledge Representation, Reasoning, and the Design of Intelligent Agents: The Answer-Set Programming Approach. Cambridge University Press. doi: 10.1017/CBO9781139342124.Google Scholar
Gramoli, V. 2015. More than you ever wanted to know about synchronization: Synchrobench, measuring the impact of the synchronization on concurrent algo- rithms. In Proceedings of the 20th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, 1–10.Google Scholar
Heidelberger, P., Norton, A. and Robinson, J. T. 1990. Parallel quicksort using fetch-and-add. IEEE Transactions on Computers 39, 1, 133138. doi: 10.1109/12.46289.CrossRefGoogle Scholar
Herlihy, M., Shavit, N., Luchangco, V. and Spear, M. 2020. The Art of Multiprocessor Programming. Newnes.Google Scholar
Krebbers, R., Timany, A. and Birkedal, L. 2017. Interactive proofs in higher-order concurrent separation logic. In Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, 205–217.Google Scholar
Kroening, D. and Tautschnig, M. 2014. CBMC-C bounded model checker: (Competition Contribution). In Tools and Algorithms for the Construction and Analysis of Systems: 20th International Conference, TACAS 2014, Held as Part of the European Joint Conferences on Theory and Practice of Software, ETAPS 2014, Grenoble, France, April 5–13, 2014. Proceedings 20, Springer, 389391.Google Scholar
Manson, J., Pugh, W. and Adve, S. V. 2005. The Java memory model. ACM SIGPLAN Notices 40, 1, 378391.CrossRefGoogle Scholar
McKenney, P. E., Boyd-Wickizer, S. and Walpole, J. 2013. RCU usage in the Linux kernel: one decade later. Technical report. Google Scholar
Mulder, I., Krebbers, R. and Geuvers, H. 2022. Diaframe: Automated verification of fine-grained concurrent programs in Iris. In Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and Implementation, 809–824.Google Scholar
Natarajan, A. and Mittal, N. 2014. Fast concurrent lock-free binary search trees. In Proc. 19th PPoPP, 317–328.Google Scholar
Owicki, S. S. and Gries, D. 1975. Proving properties of parallel programs: An axiomatic approach. Tech. rep. Cornell University.Google Scholar
Rustan, K. and Leino, M. 2010. Dafny: An automatic program verifier for functional correctness. In Logic for Programming, Artificial Intelligence, and Reasoning: 16th International Conference, LPAR-16, Dakar, Senegal, April 25–May 1, 2010, Revised Selected Papers 16, Springer, 348370.Google Scholar
Shanny, T. and Morrison, A. 2022. Occualizer: Optimistic concurrent search trees from sequential code. In 16th USENIX Symposium on Operating Systems Design and Implementation (OSDI 22), 321–337.Google Scholar
Vafeiadis, V. 2008. Modular Fine-Grained Concurrency Verification. Ph.D. thesis. University of Cambridge, UK. URL: https://ethos.bl.uk/OrderDetails.do?uin=uk.bl.ethos.612221.Google Scholar
Vafeiadis, V., Herlihy, M., Hoare, T. and Shapiro, M. 2006. Proving correctness of highly-concurrent linearisable objects. In Proceedings of the Eleventh ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, 129–136.Google Scholar
Vafeiadis, V. and Parkinson, M. 2007. A marriage of rely/guarantee and separation logic. In Int. Conf. on Conc. Theory, Springer, 256–271.Google Scholar
Valois, J. D. 1995. Lock-free linked lists using compare-and-swap. In Proceedings of the Fourteenth Annual ACM Symposium on Principles of Distributed Computing, 214–222. doi: 10.1145/224964.224988.CrossRefGoogle Scholar
Varanasi, S. C., Arias, J., Salazar, E., Li, F., Basu, K. and Gupta, G. 2022. Modeling and verification of real-time systems with event calculus and s(CASP). In Proc. 24th PADL, Springer, 181–190.Google Scholar
Varanasi, S. C., Mittal, N. and Gupta, G. 2021. Generating concurrent programs from sequential data structure knowledge using answer set programming. In Proc. 37th ICLP (Tech. Comm), vol. 345. EPTCS, 219–233.Google Scholar
Vechev, M. and Yahav, E. 2008. Deriving linearizable fine-grained concurrent objects. In Proc. 29th PLDI, 125–135. doi: 10.1145/1379022.1375598.CrossRefGoogle Scholar
Vechev, M., Yahav, E. and Yorsh, G. 2010. Abstraction-guided synthesis of synchronization. In Proceedings of the 37th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 327–338.Google Scholar