Skip to main content
QUICK REVIEW

[论文解读] Checking Robustness against TSO

Ahmed Bouajjani, Egor Derevenetc|arXiv (Cornell University)|Aug 30, 2012
Formal Methods in Verification参考文献 25被引用 3
一句话总结

本文提出一种源到源变换,将检查总存储顺序(TSO)内存模型下程序的trace鲁棒性问题,转化为在顺序一致性(SC)语义下的状态可达性问题。通过将非鲁棒性表征为‘攻击’——即负载与存储指令的特定重排序——该方法可利用SC模型检测器实现精确且可扩展的验证,适用于可判定性分析与最优栅栏插入以确保鲁棒性。

ABSTRACT

We present algorithms for checking and enforcing robustness of concurrent programs against the Total Store Ordering (TSO) memory model. A program is robust if all its TSO computations correspond to computations under the Sequential Consistency (SC) semantics. We provide a complete characterization of non-robustness in terms of so-called attacks: a restricted form of (harmful) out-of-program-order executions. Then, we show that detecting attacks can be parallelized, and can be solved using state reachability queries under SC semantics in a suitably instrumented program obtained by a linear size source-to-source translation. Importantly, the construction is valid for an arbitrary number of addresses and an arbitrary number of parallel threads, and it is independent from the data domain and from the size of store buffers in the TSO semantics. In particular, when the data domain is finite and the number of addresses is fixed, we obtain decidability and complexity results for robustness, even for an arbitrary number of threads. As a second contribution, we provide an algorithm for computing an optimal set of fences that enforce robustness. We consider two criteria of optimality: minimization of program size and maximization of its performance. The algorithms we define are implemented, and we successfully applied them to analyzing and correcting several concurrent algorithms.

研究动机与目标

  • 解决验证并发程序在TSO与SC语义下是否保持行为等价的挑战。
  • 提供一种精确且可扩展的算法,以检测TSO中由存储到负载重排序引起的非鲁棒性。
  • 支持合成最优栅栏位置以强制实现鲁棒性,同时最小化性能影响与代码膨胀。
  • 克服先前基于测试或过度近似静态分析方法的局限性,这些方法无法证明鲁棒性或无法最优地插入栅栏。
  • 支持具有任意线程数、共享变量数及数据域的通用并发程序,且与存储缓冲区大小无关。

提出的方法

  • 引入‘攻击’的概念——即一对负载与存储指令,其重排序会导致TSO下非SC行为。
  • 定义一种线性规模的源到源变换,通过在程序中插入标记,将潜在攻击编码为SC语义下的可达性查询。
  • 将TSO鲁棒性问题归约为标准的SC状态可达性问题,从而可复用现有的SC验证工具。
  • 为每个可行攻击构造反例计算,以确保归约过程的正确性与完备性。
  • 利用相同变换机制,通过在SC语义下带栅栏位置约束的可达性查询求解,计算最优栅栏集合。
  • 支持以最小化程序大小与最大化性能作为优化目标的栅栏插入。

实验结果

研究问题

  • RQ1我们能否精确检查一个并发程序在TSO下是否具有鲁棒性,即所有TSO执行是否都对应某个SC执行?
  • RQ2如何表征并检测导致TSO中非SC行为的有害乱序执行(即攻击)?
  • RQ3能否以一种既正确又完备的方式,将TSO鲁棒性问题归约为标准的SC可达性问题?
  • RQ4应插入何种最优内存栅栏集合,使得程序具有鲁棒性,同时最小化代码膨胀或最大化性能?
  • RQ5TSO鲁棒性在何种条件下是可判定的?其在一般情况下的复杂度如何?

主要发现

  • 所提出的归约将TSO鲁棒性检查转化为SC状态可达性问题,使现有SC模型检测器可实现精确验证。
  • 该方法在通过攻击检测非鲁棒性时具有正确性与完备性,无误报或漏报。
  • 对于有限数据域及固定数量的共享变量,鲁棒性是可判定的,且为PSPACE完全,即使在存储缓冲区无界且线程数任意的情况下亦成立。
  • 源到源变换的规模为线性,且与数据域大小及缓冲区容量无关。
  • 栅栏插入算法在最小化程序大小与最大化性能两个目标下均能生成最优解。
  • 该方法已实现并成功应用于验证与修正真实并发算法,证明了其实际可用性与可扩展性。

更好的研究,从现在开始

从阅读论文到最终审阅,大幅缩短您的研究时间。

无需绑定信用卡

本解读由 AI 生成,并经人工编辑审核。