一句话:提出 AtomiS,通过接口与字段类型限定和静态分析自动生成并发控制,使数据中心同步更实用。
数据中心同步(DCS)把并发限制的推理从控制结构转移到数据声明,但现有方案常需大量注解,且同一方法可能需为不同限定参数提供多份实现。AtomiS 仅在接口定义中限定参数与返回值类型、在类定义中限定字段类型,并可用类型参数抽象字段,使类实现几乎无需注解。其静态分析据此推断各方法局部的原子性约束,只保留与规约一致的合法方法变体并生成代码,随后自动注入并发控制原语以避免数据竞争、原子性违反和死锁。作者用 Java 实现并在真实代码上验证;在所分析基准中,AtomiS 所需注解少于原本需要加锁的区域数,也少于参考 DCS 方案 Atomic Sets。
Data-Centric Synchronization (DCS) shifts the reasoning about concurrency restrictions from control structures to data declaration. It is a high-level declarative approach that abstracts away from the actual concurrency control mechanism(s) in use. Despite its advantages, the practical use of DCS is hindered by the fact that it may require many annotations and/or multiple implementations of the same method to cope with differently qualified parameters. To overcome these limitations, in this paper we present AtomiS, a new DCS approach that requires only qualifying types of parameters and return values in interface definitions, and of fields in class definitions. The latter may also be abstracted away in type parameters, rendering class implementations virtually annotation-free. From this high level specification, a static analysis infers the atomicity constraints that are local to each method, considering valid only the method variants that are consistent with the specification, and performs code generation for all valid variants of each method. The generated code is then the target for automatic injection of concurrency control primitives that are responsible for ensuring the absence of data-races, atomicity-violations and deadlocks. We provide a Java implementation and showcase the applicability of AtomiS in real-life code. For the benchmarks analysed, AtomiS requires fewer annotations than the original number of regions requiring locks, as well as fewer annotations than Atomic Sets (a reference DCS proposal).
@article{paperbot1856,
title = {AtomiS: Data-Centric Synchronization Made Practical},
author = {Hervé Paulino and Ana Almeida Matos and Jan Cederquist and Marco Giunti and João Matos and António Ravara},
journal = {Proceedings of the ACM on Programming Languages},
volume = {7},
number = {OOPSLA2},
year = {2023},
doi = {10.1145/3622801}
}