具有内存回收的无锁数据结构的指针生存周期类型
Pointer Life Cycle Types for Lock-Free Data Structures with Memory Reclamation
摘要:
我们考虑验证无锁数据结构,手动管理其内存的帮助下,一个安全的内存回收(SMR)算法。我们的第一个贡献是一个类型系统,它检查程序是否正确地管理它的内存。如果类型检查成功,则可以安全地忽略SMR算法并将程序视为处于垃圾回收之下。直观地说,我们的类型跟踪由SMR算法保证的指针保护。有两个设计决策。类型系统不跟踪任何形状信息,这使得它非常轻量级。相反,我们依赖于不变的注释,假设SMR的保护。为此,我们引入了天使,具有天使语义的幽灵变量。此外,SMR算法不是硬编码的,而是类型系统定义的一个参数。为了实现这一点,我们依靠最近的规约语言SMR算法。我们的第二个贡献是自动化的类型推断和不变式检查。对于类型推断,我们给出了一个二次时间算法。对于不变式检查,我们给出了一个源代码到源代码的翻译,将我们的程序链接到现成的验证工具。它编译了天使的语义。这允许我们以猜测和检查的方式自动推断适当的注释。为了证明我们的基于类型的验证方法的有效性,我们检查线性化的各种列表和设置实现从文献中的危险指针和基于时代的内存回收。对于许多示例,这是它们第一次被自动验证。对于那些有竞争对手,我们获得了高达两个数量级的速度。
英文摘要:
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.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。