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