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. Traditional definitions of critical sections implicitly assume that protected events belong to the same thread. We demonstrate that this assumption does not hold 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程序本质的追踪模型,我们给出了不施加每线程限制的临界区基于追踪的特征描述。因此,临界区可跨越多个线程。此类多线程临界区在实际程序中自然产生,并填补了标准锁集合构造中的语义鸿沟。