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程序本质的迹模型,我们给出了一种不施加单线程限制的临界区基于迹的特征描述。由此,临界区可跨越多个线程。这种*多线程*临界区真实地出现在实际程序中,并填补了标准锁集构造中的语义空缺。