保持同步竞赛的最优预测
Optimal Prediction of Synchronization-Preserving Races
摘要:
众所周知,并发程序很难正确编写,因为调度的不确定性引入了难以检测和重现的细微错误。最常见的并发错误是(数据)争用,当并发执行内存冲突操作时会发生这种错误。因此,已经做出了相当大的努力来开发用于种族检测的有效技术。最常见的方法是动态竞争预测:给定一个并发程序的观察到的、无竞争的跟踪$σ$,任务是决定$σ$的事件是否可以被正确地重新排序到一个跟踪$σ^*$,该跟踪见证了隐藏在$σ$中的竞争。在这项工作中,我们介绍了同步(hronization)保持种族的概念。当存在其中同步操作(例如,锁的获取和释放)以与$σ$中相同的顺序出现。这是一个广义的定义,严格包含了著名的“比赛前发生”的概念。我们的主要结果如下。首先,我们开发了一个健全的和完整的算法预测同步保持种族。对于中等值的参数(如线程数),算法在$\widetilde{O}(\mathcal{N})$时间和空间中运行,其中$\mathcal{N}$是跟踪$σ$的长度。其次,我们证明了该问题有一个$Ω(\mathcal{N}/\log^2 \mathcal{N})$空间下界,因此我们的算法本质上是时间和空间最优的。第三,我们表明,预测比赛,即使只是一个单一的逆转两个同步操作是$\operatorname{NP}$ -完整的,甚至$\operatorname{W}[1]$ -硬参数时,线程的数量。因此,同步保护的特点正是比赛预测的易处理边界,我们的算法是几乎最佳的易处理的一面。
英文摘要:
Concurrent programs are notoriously hard to write correctly, as scheduling nondeterminism introduces subtle errors that are both hard to detect and to reproduce. The most common concurrency errors are (data) races, which occur when memory-conflicting actions are executed concurrently. Consequently, considerable effort has been made towards developing efficient techniques for race detection. The most common approach is dynamic race prediction: given an observed, race-free trace $σ$ of a concurrent program, the task is to decide whether events of $σ$ can be correctly reordered to a trace $σ^*$ that witnesses a race hidden in $σ$. In this work we introduce the notion of sync(hronization)-preserving races. A sync-preserving race occurs in $σ$ when there is a witness $σ^*$ in which synchronization operations (e.g., acquisition and release of locks) appear in the same order as in $σ$. This is a broad definition that strictly subsumes the famous notion of happens-before races. Our main results are as follows. First, we develop a sound and complete algorithm for predicting sync-preserving races. For moderate values of parameters like the number of threads, the algorithm runs in $\widetilde{O}(\mathcal{N})$ time and space, where $\mathcal{N}$ is the length of the trace $σ$. Second, we show that the problem has a $Ω(\mathcal{N}/\log^2 \mathcal{N})$ space lower bound, and thus our algorithm is essentially time and space optimal. Third, we show that predicting races with even just a single reversal of two sync operations is $\operatorname{NP}$-complete and even $\operatorname{W}[1]$-hard when parameterized by the number of threads. Thus, sync-preservation characterizes exactly the tractability boundary of race prediction, and our algorithm is nearly optimal for the tractable side.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。