一句话:提出指针生命周期类型系统,检查无锁数据结构对 SMR 内存的安全管理,并自动推断类型与不变量以验证线性一致。
该论文关注使用安全内存回收(SMR)算法手动管理内存的无锁数据结构验证。其核心是提出一种指针生命周期类型系统,检查程序是否正确管理受 SMR 保护的指针;若类型检查通过,便可忽略 SMR 并在垃圾回收语义下验证程序。类型系统不追踪形状信息而保持轻量,依赖不变量注解和具有天使语义的 ghost 变量 angels 来断言保护;SMR 算法作为类型系统参数。作者给出二次时间类型推断算法,并通过保持天使语义的源到源翻译,将不变量检查交给现成验证工具自动完成。实验对文献中多种链表和集合实现,分别使用 hazard pointer 与 epoch-based reclamation 进行线性化验证,许多例子首次自动验证,较已有工具提速最多两个数量级。
We consider the verification of lock-free data structures that manually manage their memory with the help of a safe memory reclamation (SMR) algorithm. Our first contribution is a type system that checks whether a program properly manages its memory. If the type check succeeds, it is safe to ignore the SMR algorithm and consider the program under garbage collection. Intuitively, our types track the protection of pointers as guaranteed by the SMR algorithm. There are two design decisions. The type system does not track any shape information, which makes it extremely lightweight. Instead, we rely on invariant annotations that postulate a protection by the SMR. To this end, we introduce angels, ghost variables with an angelic semantics. Moreover, the SMR algorithm is not hard-coded but a parameter of the type system definition. To achieve this, we rely on a recent specification language for SMR algorithms. Our second contribution is to automate the type inference and the invariant check. For the type inference, we show a quadratic-time algorithm. For the invariant check, we give a source-to-source translation that links our programs to off-the-shelf verification tools. It compiles away the angelic semantics. This allows us to infer appropriate annotations automatically in a guess-and-check manner. To demonstrate the effectiveness of our type-based verification approach, we check linearizability for various list and set implementations from the literature with both hazard pointers and epoch-based memory reclamation. For many of the examples, this is the first time they are verified automatically. For the ones where there is a competitor, we obtain a speed-up of up to two orders of magnitude.
@article{paperbot550,
title = {Pointer life cycle types for lock-free data structures with memory reclamation},
author = {Roland Meyer and Sebastian Wolff},
journal = {Proceedings of the ACM on Programming Languages},
volume = {4},
number = {POPL},
year = {2019},
doi = {10.1145/3371136}
}