arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2101.01312cs.PL
收藏

Promise的所有权策略和死锁检测器

An Ownership Policy and Deadlock Detector for Promises

Caleb Voss, Vivek Sarkar

摘要:

任务并行程序通常在某些限制下享有死锁自由,例如使用结构化连接操作,如Cilk和X10,或使用异步任务期货以及避免死锁的策略,如已知连接或传递连接。然而,promise是一种流行的并行任务同步原语,它不享有无死锁保证。promise可以表现出类似死锁的bug;然而,目前还没有为promise定义死锁的概念。为了解决这些挑战,我们提出了一种所有权语义,其中每个promise都与当前打算履行它的任务相关联。所有权可以立即识别任务未能履行其负责的promise的错误。所有权进一步支持讨论任务和promise之间的死锁循环,并允许我们为promise引入类似死锁的错误的健壮定义。在这种情况下,循环检测是不平凡的,因为它与promise所有权的变化并发。我们提供了一个无锁的算法,精确的运行时死锁检测。我们将展示如何获得内存一致性的标准,我们的算法下TSO和Java和C++内存模型的正确性。评估比较我们的检测算法的执行时间和内存使用开销的基准程序相对于未经验证的基线。我们的检测器表现出12%(1.12 $\times$)的几何平均时间开销和6%(1.06 $\times$)的几何平均内存开销,这是较小的开销比过去的方法死锁周期检测。

英文摘要:

Task-parallel programs often enjoy deadlock freedom under certain restrictions, such as the use of structured join operations, as in Cilk and X10, or the use of asynchronous task futures together with deadlock-avoiding policies such as Known Joins or Transitive Joins. However, the promise, a popular synchronization primitive for parallel tasks, does not enjoy deadlock-freedom guarantees. Promises can exhibit deadlock-like bugs; however, the concept of a deadlock is not currently well-defined for promises. To address these challenges, we propose an ownership semantics in which each promise is associated to the task which currently intends to fulfill it. Ownership immediately enables the identification of bugs in which a task fails to fulfill a promise for which it is responsible. Ownership further enables the discussion of deadlock cycles among tasks and promises and allows us to introduce a robust definition of deadlock-like bugs for promises. Cycle detection in this context is non-trivial because it is concurrent with changes in promise ownership. We provide a lock-free algorithm for precise runtime deadlock detection. We show how to obtain the memory consistency criteria required for the correctness of our algorithm under TSO and the Java and C++ memory models. An evaluation compares the execution time and memory usage overheads of our detection algorithm on benchmark programs relative to an unverified baseline. Our detector exhibits a 12% (1.12$\times$) geometric mean time overhead and a 6% (1.06$\times$) geometric mean memory overhead, which are smaller overheads than in past approaches to deadlock cycle detection.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑