paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Towards generating thread-safe classes automatically

迈向自动生成线程安全类
ASE Proceedings of the 35th IEEE/ACM International Conference on Automated Software Engineering2020匹配度 2/10 · 论文聚焦并发程序中的锁策略合成与线程安全类自动生成,属于程序合成/并发领域,与用户核心关注的 LLM 与静态分析交叉、浮点程序分析、贝叶斯程序分析没有直接交集。虽然涉及访问注解推断,但并非用户当前追踪的问题方向。引用 1 inbox
Haichi Wang, Zan Wang, Jun Sun, Shuang Liu, Ayesha Sadiq, Yuan-Fang Li
crossref: 2026-09-12

AI 速览

一句话:提出 AutoLock,无需规约即可从顺序正确的类自动推断访问注解、合成锁策略并实现线性化线程安全类。

现有 Java/C 并发模型要求程序员显式加锁和释放锁来实现线程安全类,容易出错并引发大量并发缺陷。本文提出 AutoLock:给定仅在顺序客户端下正确的类,在无需类规约的情况下,全自动生成具有线性化语义的线程安全版本。AutoLock 分三步:推断变量访问与别名等访问注解;据此合成锁策略;一致地实现该锁策略。作者在一组基准程序上评估,结果表明 AutoLock 能有效生成线程安全类,并可避免已有并发缺陷。

问题
现有 Java/C 等语言依赖程序员手动加锁实现线程安全类,过程易错,且在没有规约时难以自动保证并发正确性。
方法
AutoLock 从顺序正确的类出发,无需规约,依次推断访问注解、合成锁策略并一致实现,从而生成线性化线程安全类。
评估
在一组基准程序上评估,结果显示 AutoLock 能有效生成线程安全类,并可预防已有并发缺陷。
原文摘要(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.

链接与引用

DOI 原文 ·

BibTeX
@inproceedings{paperbot5920,
  title = {Towards generating thread-safe classes automatically},
  author = {Haichi Wang and Zan Wang and Jun Sun and Shuang Liu and Ayesha Sadiq and Yuan-Fang Li},
  booktitle = {ASE},
  year = {2020},
  doi = {10.1145/3324884.3416625}
}