arXivDaily arXiv每日学术速递 周一至周五更新
感恩节,周五至周末无更新,大家顺遂。周一再来吧
arXiv 2304.11983cs.DC
收藏

保护锁以防止不平衡的 unlock()

Protecting Locks Against Unbalanced Unlock()

Vivek Shahare, Milind Chabbi, Nikhil Hegde

AI总结:

针对未先 lock() 即调用 unlock() 的常见并发误用,本文分析多种流行加锁算法的后果,提出检测与协议修复方法,并证明其性能损失轻微。

摘要:

锁是一种基础构建块同步原语,可在共享内存并行程序中实现对共享数据的互斥访问。互斥通常通过用一对 lock() 和 unlock() 操作保护访问共享数据的代码来实现。当这种操作顺序被违反时,就会出现并发缺陷。本文研究一种特定的误用模式,即在没有首先发出 lock() 的情况下发出 unlock(),这种情况可能发生在具有复杂控制流的代码中。令人惊讶的是,在我们研究的几个重要开源代码仓库中,这种误用相当常见。我们系统地研究了在几种流行的加锁算法中由这种误用导致的情况。我们研究了如何检测这种误用,以及如何修复加锁协议以避免误用带来的不良后果。大多数锁只需简单修改即可检测并防止这种误用。我们评估了修改后实现的性能特征,结果表明在大多数可扩展锁中只会带来轻微的性能损失。

英文摘要:

The lock is a building-block synchronization primitive that enables mutually exclusive access to shared data in shared-memory parallel programs. Mutual exclusion is typically achieved by guarding the code that accesses the shared data with a pair of lock() and unlock() operations. Concurrency bugs arise when this ordering of operations is violated. In this paper, we study a particular pattern of misuse where an unlock() is issued without first issuing a lock(), which can happen in code with complex control flow. This misuse is surprisingly common in several important open-source repositories we study. We systematically study what happens due to this misuse in several popular locking algorithms. We study how misuse can be detected and how the locking protocols can be fixed to avoid the unwanted consequences of misuse. Most locks require simple changes to detect and prevent this misuse. We evaluate the performance traits of modified implementations, which show mild performance penalties in most scalable locks.

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

↑