Detecting and Eliminating Potential Violations of Sequential Consistency for Concurrent C/C++ Programs
Autor: | Xiaobing Feng, Pen-Chung Yew, Yuelu Duan, Lei Wang, Chao Zhang |
---|---|
Rok vydání: | 2009 |
Předmět: |
Source code
Computer science Programming language Sequential consistency media_common.quotation_subject Parallel computing Software_PROGRAMMINGTECHNIQUES Cilk computer.software_genre Debugging Software bug Concurrent computing Graph (abstract data type) computer Cycle detection computer.programming_language media_common |
Zdroj: | CGO |
DOI: | 10.1109/cgo.2009.29 |
Popis: | When a concurrent shared-memory program written with a sequential consistency (SC) model is run on a machine implemented with a relaxed consistency (RC) model, it could cause SC violations that are very hard to debug. To avoid such violations, programmers need to provide explicit synchronizations or insert fence instructions. In this paper, we propose a scheme to detect and eliminate potential SC violations by combining Shasha/Snir's conflict graph and delay set theory with existing data race detection techniques. For each execution, we generate a race graph, which contains the improperly synchronized conflict accesses, called race accesses, and race cycles formed with those accesses. As a race cycle would probably lead to a non-sequential-consistent execution, we call it a potential violation of sequential consistency (PVSC) bug. We then compute the race delays of race cycles, and suggest programmers to insert fences into source code to eliminate PVSC bugs. We further convert a race graph into a PC race graph, and improves cycle detection and race delay computation to O(n^2), where n is the number of race access instructions. We evaluate our approach with the SPLASH-2 benchmarks, two large real-world applications (MySQL and Apache), and several multi-threaded Cilk programs. The results show that (1) the proposed approach could effec-tively detect PVSC bugs in real-world applications with good scalability; (2) it retains most of the performance of the concurrent program after inserting required fence instructions, with less than 6.3% performance loss; and (3) the additional cost of our approach over traditional race detection techniques is quite low, with 3.3% on average. |
Databáze: | OpenAIRE |
Externí odkaz: |