Locks are a standard mechanism for synchronizing concurrent threads. The standard lock set construction assumes that critical sections are confined to a single thread, and therefore only accounts for locks acquired within that thread. The commonly used notion of a critical section implicitly assumes that protected events belong to the same thread. We show that this assumption is not valid for general C/Pthread executions. Using a trace model that captures the essence of C/Pthread programs, we give a trace-based characterization of critical sections that does not impose a per-thread restriction. As a result, critical sections may span multiple threads. Such \emph{multi-thread} critical sections arise naturally in real programs and close a semantic gap in the standard lock set construction.
翻译:锁是同步并发线程的标准机制。标准的锁集构造假设临界区仅限于单个线程,因此仅考虑该线程内获取的锁。常用的临界区概念隐含地假设受保护事件属于同一线程。我们证明这一假设对于一般的C/Pthread程序执行并不成立。通过建立捕捉C/Pthread程序本质的迹模型,我们给出了不施加单线程限制的基于迹的临界区特征描述。因此,临界区可能跨越多个线程。这类\emph{多线程}临界区在实际程序中自然出现,并弥补了标准锁集构造中的语义鸿沟。