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 $\Theta(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 $\Theta(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.
翻译:动态技术是分析并行程序的一种可缩放和有效的方法。 这些技术不是分析一个程序的所有行为, 而是分析一个程序的所有行为, 而是通过集中执行一个程序来检测错误。 这些技术中的一个关键步骤通常是定义执行中的事件之间的因果关系, 然后用矢量时钟来计算。 这个简单的数据结构可以存储线条的逻辑时间。 矢量时钟的两个基本操作, 即连接和复制, 需要 $\ The( k) 时间, 即 $k$ 是线索的数量。 因此, 当一个程序大时, 这些技术不是分析错误。 在这项工作中, 我们引入树时钟, 一个新的数据结构, 取代在程序执行中计算因果关系命令时的矢量时钟。 加入和复制树钟需要的时间与正在修改的条目数量大致成正比。 矢量时钟的两个基本操作不需要花费1美元\\ Theta( k) 美元, 每个应用程序的费用。 我们显示, 当使用经典的时( HB) 部分程序是最佳的 。 在其它数据结构中, 没有其它数据结构可以显示部分时间 。 因此, AS- be lade ladeal- h ladeal or- dal or- deal rode lax, lax lax lax 。