Towards Generating Thread-Safe Classes Automatically
Haichi Wang, Zan Wang, Jun Sun, Shuang Liu, Ayesha Sadiq, Yuan-Fang Li
Abstract
The existing concurrency model for Java (or C) requires programmers to design and implement thread-safe classes by explicitly acquiring locks and releasing locks. Such a model is error-prone and is the reason for many concurrency bugs. While there are alternative models like transactional memory, manually writing locks remains prevalent in practice. In this work, we propose AutoLock, which aims to solve the problem by fully automatically generating thread-safe classes. Given a class which is assumed to be correct with sequential clients, AutoLock automatically generates a thread-safe class which is linearizable, and does it in a way without requiring a specification of the class. AutoLock takes three steps: (1) infer access annotations (i.e., abstract information on how variables are accessed and aliased), (2) synthesize a locking policy based on the access annotations, and (3) consistently implement the locking policy. AutoLock has been evaluated on a set of benchmark programs and the results show that AutoLock generates thread-safe classes effectively and could have prevented existing concurrency bugs.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext df2aeebb-7b91-42d5-a7d5-0e13088eff9bCited by top-tier papers1
Ask how each one uses itRelated papers
- AtomiS: Data-Centric Synchronization Made PracticalHervé Paulino, Ana Almeida Matos, Jan Cederquist, Marco Giunti et al.OOPSLA 2023
- Concrat: An Automatic C-to-Rust Lock API Translator for Concurrent ProgramsJaemin Hong, Sukyoung RyuICSE 2023 · 17 citations
- Soundness of Predictive Concurrency AnalysesShuyang Liu, Doug Lea, Jens PalsbergOOPSLA 2025
- Verifying observational robustness against a c11-style memory modelRoy David Margalit, Ori LahavPOPL 2021 · 22 citations
- Investigating the semantics of futures in transactional memory systemsJingna Zeng, Shady Issa, Paolo Romano, Luís E. T. Rodrigues et al.PPoPP 2021 · 4 citations
