We address a problem arising in debugging parallel programs, detecting race conditions in programs using semaphores for synchronization. It is NP-complete to detect race conditions in programs that use many semaphores. We show in this paper that it remains NP-complete even if the programs are allowed to use only two semaphores. For the case of single semaphore, Lu, Klein, and Netzer gave the previously only-known polynomial-time algorithm that runs in time $O(n^{1.5}p)$, where $p$ is the number of processors and $n$ is the total number of semaphore operations executed. Their algorithm, however, detects only a special class of race conditions. In this paper we cope with the general race-condition detection problem and give an $O(np\log n)$-time algorithm. The output of our algorithm is a compact representation from which one can determine in constant time whether a race condition exists between two given operations.
Recommendations
Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables
PADTAD '06: Proceedings of the 2006 workshop on Parallel and distributed systems: testing and debuggingConcurrent programs are notorious for containing errors that are difficult to reproduce and diagnose. A common kind of concurrency error is deadlock, which occurs when some threads are permanently blocked. This paper defines a run-time notion of ...
Parallelizing data race detection
ASPLOS '13: Proceedings of the eighteenth international conference on Architectural support for programming languages and operating systemsDetecting data races in multithreaded programs is a crucial part of debugging such programs, but traditional data race detectors are too slow to use routinely. This paper shows how to speed up race detection by spreading the work across multiple cores. ...
Parallelizing data race detection
ASPLOS '13Detecting data races in multithreaded programs is a crucial part of debugging such programs, but traditional data race detectors are too slow to use routinely. This paper shows how to speed up race detection by spreading the work across multiple cores. ...