AutoSynch:一个基于谓词标记的自动信号监测器
AutoSynch: An Automatic-Signal Monitor Based on Predicate Tagging
摘要:
大多数程序设计语言使用带有显式信号的监视器,用于共享内存程序中的同步。要求程序员显式地给线程发信号会导致许多并发错误,这是由于错过了通知,或者通知了错误的条件变量。在本文中,我们描述了一个在Java中的自动同步信令监视器的实现称为AutoSynch,消除了这样的并发错误,从程序员消除了信令的负担。我们表明,认为自动信号监测器是昂贵的是错误的。对于大多数问题,基于AutoSynch的程序几乎与基于显式信号的程序一样快。对于某些人来说,AutoSynch甚至比显式信号更快,因为它从不使用signalAll,而程序员最终使用具有显式信号机制的signalAll。AutoSynch基于三个新颖的想法实现了同步的效率。我们引入了一个称为全球化的操作,它使谓词评估在每个线程,从而减少在程序执行过程中的上下文切换。其次,AutoSynch通过使用一个名为relay invariance的属性来避免signalAll,该属性保证只要有可能,总是至少有一个条件为true的线程已被发送信号。最后,AutoSynch使用一种称为谓词标记的技术来有效地确定应该发出信号的线程。为了评估AutoSynch的效率,我们已经实现了许多不同的著名的同步问题,如生产者/消费者问题,读者/作家问题,和用餐哲学家问题。结果表明,AutoSynch几乎与显式信号监视器一样有效,在某些情况下甚至更有效。
英文摘要:
Most programming languages use monitors with explicit signals for synchronization in shared-memory programs. Requiring program- mers to signal threads explicitly results in many concurrency bugs due to missed notifications, or notifications on wrong condition variables. In this paper, we describe an implementation of an au- tomatic signaling monitor in Java called AutoSynch that eliminates such concurrency bugs by removing the burden of signaling from the programmer. We show that the belief that automatic signaling monitors are prohibitively expensive is wrong. For most problems, programs based on AutoSynch are almost as fast as those based on explicit signaling. For some, AutoSynch is even faster than explicit signaling because it never uses signalAll, whereas the programmers end up using signalAll with the explicit signal mechanism. AutoSynch achieves efficiency in synchronization based on three novel ideas. We introduce an operation called globalization that enables the predicate evaluation in every thread, thereby reducing context switches during the execution of the program. Secondly, AutoSynch avoids signalAll by using a property called relay invari- ance that guarantees that whenever possible there is always at least one thread whose condition is true which has been signaled. Finally, AutoSynch uses a technique called predicate tagging to efficiently determine a thread that should be signaled. To evaluate the effi- ciency of AutoSynch, we have implemented many different well- known synchronization problems such as the producers/consumers problem, the readers/writers problems, and the dining philosophers problem. The results show that AutoSynch is almost as efficient as the explicit-signal monitor and even more efficient for some cases.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。