论文标题
并发执行中的因果订购的树时钟数据结构
A Tree Clock Data Structure for Causal Orderings in Concurrent Executions
论文作者
论文摘要
动态技术是分析并发程序的可扩展有效方法。这些技术没有分析程序的所有行为,而是通过专注于单个程序执行来检测错误。这些技术的关键步骤通常是定义执行中事件之间的因果排序,然后使用矢量时钟计算,这是一个简单的数据结构,它存储了线程的逻辑时间。向量时钟的两个基本操作,即加入和复制,需要$θ(k)$时间,其中$ k $是线程数。因此,当$ k $很大时,它们是计算瓶颈。 在这项工作中,我们介绍了树时钟,这是一种新的数据结构,替换了用于计算程序执行中因果订购的向量时钟。连接和复制树时钟需要时间与正在修改的条目数量大致成正比,因此两个操作不会遭受每个应用程序的A-Priori $θ(k)$成本。我们表明,当使用(HB)部分顺序的经典时,树时钟是最佳的,因为没有其他数据结构可以导致较小的渐近运行时间。此外,我们证明了树时钟可用于计算其他部分订单,例如可安排的happens-before(SHB)和标准的Mazurkiewicz(MAZ)部分顺序,因此是一种多功能数据结构。我们的实验表明,仅通过用树时钟替换矢量时钟,该计算的价格从$ 2.02 \ times $加快到$ 2.66 \ times $ $(SHB)和$ 2.97 \ times $ \ times $(hb)的平均每个基准。这些结果表明,在并发分析中,树时钟有可能成为具有广泛应用的标准数据结构。
Dynamic techniques are a scalable and effective way to analyze concurrent programs. Instead of analyzing all behaviors of a program, these techniques detect errors by focusing on a single program execution. Often a crucial step in these techniques is to define a causal ordering between events in the execution, which is then computed using vector clocks, a simple data structure that stores logical times of threads. The two basic operations of vector clocks, namely join and copy, require $Θ(k)$ time, where $k$ is the number of threads. Thus they are a computational bottleneck when $k$ is large. In this work, we introduce tree clocks, a new data structure that replaces vector clocks for computing causal orderings in program executions. Joining and copying tree clocks takes time that is roughly proportional to the number of entries being modified, and hence the two operations do not suffer the a-priori $Θ(k)$ cost per application. We show that when used to compute the classic happens-before (HB) partial order, tree clocks are optimal, in the sense that no other data structure can lead to smaller asymptotic running time. Moreover, we demonstrate that tree clocks can be used to compute other partial orders, such as schedulable-happens-before (SHB) and the standard Mazurkiewicz (MAZ) partial order, and thus are a versatile data structure. Our experiments show that just by replacing vector clocks with tree clocks, the computation becomes from $2.02 \times$ faster (MAZ) to $2.66 \times$ (SHB) and $2.97 \times$ (HB) on average per benchmark. These results illustrate that tree clocks have the potential to become a standard data structure with wide applications in concurrent analyses.