[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ skip to main content
10.1109/CGO.2009.29acmconferencesArticle/Chapter ViewAbstractPublication PagescgoConference Proceedingsconference-collections
Article

Detecting and Eliminating Potential Violations of Sequential Consistency for Concurrent C/C++ Programs

Published: 22 March 2009 Publication History

Abstract

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.

References

[1]
D. Shasha, M. Snir, Efficient and correct execution of parallel programs that share memory. ACM Trans. Program. Lang. Syst., 10(2):282- 312, 1988.
[2]
A. Kamil, J. Su, K. Yelick, Make Sequential Consistency Practical in Titanium, Proc. of the ACM/IEEE SC 2005 Conf. Supercomputing, 2005.
[3]
X. Fang, J. Lee, S.P. Midkiff, Automatic Fence Insertion for Shared Memory Multiprocessing, Proc. of the Intl. Conf. on Supercomputing, 2003.
[4]
J. Lee, D.A. Padua, Hiding Relaxed Memory Consistency with a Compiler. Proc. of Intl Conf. on Parallel Architectures and Compilation Techniques, 2000.
[5]
W.Y. Chen, A. Krishnamurthy, K. Yelick, Polynomial-Time algorithms for Enforcing Sequential Consistency in SPMD Programs with Arrays. In Languages and Compilers for Parallel Computing, 2003.
[6]
Y. Yu, T. Rodeheffer, W. Chen, RaceTrack: Efficient Detection of Data Race Conditions via Adaptive Tracking. In 20th ACM Symposium on Operating Systems Principles, 2005.
[7]
J.-D.Choi et al. Efficient and precise data race detection for multithreaded object-oriented programs. In Proc. of Programming Language Design and Implementation, 2002.
[8]
R.O. Callahan, J.-D. Choi, Hybrid Dynamic Data Race Detection. In Principles and Practice of Parallel Programming, 2003.
[9]
A. Dining and E. Schonberg. An empirical comparison of monitoring algorithms for access anomaly detection. In Principles and Practice of Parallel Programming, 1990.
[10]
R.H.B. Netzer and B.P. Miller. Improving the accuracy of data race detection. In Principles and Practice of Parallel Programming, 1991.
[11]
S. Narayannasamy, Z. Wang, J. Tigani, A. Edwards, B. Calder. Automatically classifying benign and harmful data races using replay analysis. In Programming Language Design and Implementation, 2007.
[12]
D. Perkovic and P.J. Keleher. Online data-race detection via coherency guarantees. In Operating System Design and Implementation, 1996.
[13]
S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson. Eraser: A dynamic data race detector for multithreaded programs. In ACM Tran. On Computer System, 1997.
[14]
C. von Praun and T.R. Gross. Object race detection. In Object-Oriented Programming, Systems, Languages and Applications, 2001.
[15]
E. Pozniansky and A. Schuster. Efficient on-the-fly data race detection in multithreaded c++ programs. In Principles and Practice of Parallel Programming, 2003.
[16]
C. Boyapati. R. Lee, and M. Rinard. Owership types for safe programming: Preventing data races and deadlocks. In Object-Oriented Programming, Systems, Languages and Applications, 2002
[17]
C. Flanagan and S.N. Freund. Type-based race detection for java. In Programming Language Design and Implementation, 2000.
[18]
K. Gharachorloo, P.B. Gibbons, Detecting violations of sequential consistency. In Symposium on Parallel Algorithms and Architectures, 1991.
[19]
S.V. Adve, M.D. Hill, B.P. Miller, R.H.B. Netzer, Detecting data races on weak memory systems. In Intl. Symposium on Computer Architecture, 1991.
[20]
M. Prvulovic, CORD: Cost-effective (and nearly overhead-free) Order-Recording and Data race detection. In High Performance Computer Architecture, 2006.
[21]
M. Prvulovic and J. Torrellas. ReEnact: Using thread-level speculation mechanisms to debug data races in multithreaded codes. In Intl. Symposium on Computer Architecture, 2003.
[22]
S.L. Min and J.-D. Choi. An efficient cache-based access anomaly detection scheme. In Architectural Support for Programming Languages and Operating Systems, 1991.
[23]
J.D. Choi, S.L. Min, Race Frontier: Reproducing Data Races in Parallel Program Debugging, In Principles and Practice of Parallel Programming, 1991.
[24]
S. Burckhardt, M. Musuvathi, Effective Program Verification for Relaxed Memory Models. In Computer Aided Verification, 2008.
[25]
S. Burckhardt, R. Alur, M.M.K. Martin, CheckFence: checking consistency of concurrent data types on relaxed memory models. In Programming Language Design and Implementation, 2007.
[26]
H.J. Boehm, S.V. Adve, Foundations of the C++ Concurrency Memory Model, In Programming Language Design and Implementation, 2008.
[27]
L. Lamport. How to make a multiprocessor computer that correctly executes multiprocess programs. In IEEE Tran. On Computer, 1979.
[28]
S.V. Adve, K. Gharachorloo, Shared Memory Consistency Models: A tutorial. In IEEE computer, 1995.
[29]
S. Lu, J. Tucek, F. Qin, Y.Y. Zhou. AVIO: Detecting atomicity violations via access interleaving invariants. In Architecture Support for Program Languages and Operating Systems, 2006.
[30]
M. Xu, R. Bodik, M. Hill. A serializability violation detector for shared-memory server programs. In Programming Language Design and Implementation, 2005.
[31]
S. Lu, S. Park, E. Seo, Y.Y. Zhou. Learning from mistakes-a comprehensive study on real world concurrency bug characteristics. In Architecture Support for Programming Languages and Operating Systems, 2008.
[32]
S. Lu, S. Park, C. Hu, X. Ma, W. Jiang, Z. Li, R. Popa, Y.Y. Zhou. MUVI: automatically inferring multi-variable access correlations and detecting related semantic and concurrency bugs. In Symposium on Operating System Principles, 2007.
[33]
D. Schmidt, T. Harrison. Double-checked-locking: an optimization pattern for efficiently initializing and accessing thread-safe objects. In Programming Language Design and Implementation, 1996.
[34]
The "Double-checked-locking is broken" declaration. http://www. cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html.
[35]
M. Frigo, C.E. Leiserson, K.H. Randall. The Implementation of the cilk-5 multithreaded language. In Programming Language Design and Implementation, 1998.
[36]
N. Nethercote and J. Seward. Valgrind: A Program Supervision Framework. Electr. In Notes Theor. Comput. Sci., 2003.
[37]
P. Zhou, R. Teodorescu, and Y. Zhou. Hard: Hardware-assisted lockset-based race detection. In High Performance Computer Architecture, 2007.
[38]
Intel 64 Architecture Memory Ordering White Paper. http://developer.intel.com/products/processor/manuals/318147.pdf
[39]
J. Manson, W. Pugh and S. Adve. The Java memory model. In Proc. Symp. on Principles of Programming Languages, 2005.
[40]
D. Aspinall and J. Sevcik. Java Memory Model examples: Good, bad, and ugly. VAMP07 Proceedings http://www.cs.ru.nl/chaack/VAMP07/,2007.

Cited By

View all

Recommendations

Comments

Please enable JavaScript to view thecomments powered by Disqus.

Information & Contributors

Information

Published In

cover image ACM Conferences
CGO '09: Proceedings of the 7th annual IEEE/ACM International Symposium on Code Generation and Optimization
March 2009
299 pages
ISBN:9780769535760

Sponsors

Publisher

IEEE Computer Society

United States

Publication History

Published: 22 March 2009

Check for updates

Author Tags

  1. Sequential consistency
  2. data race detection
  3. delay set
  4. fence
  5. relaxed memory model

Qualifiers

  • Article

Conference

CGO '09

Acceptance Rates

CGO '09 Paper Acceptance Rate 26 of 70 submissions, 37%;
Overall Acceptance Rate 312 of 1,061 submissions, 29%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 06 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2015)Leveraging Transactional Execution for Memory Consistency Model EmulationACM Transactions on Architecture and Code Optimization10.1145/278698012:3(1-24)Online publication date: 31-Aug-2015
  • (2015)Asymmetric Memory FencesACM SIGARCH Computer Architecture News10.1145/2786763.269438843:1(531-543)Online publication date: 14-Mar-2015
  • (2015)Asymmetric Memory FencesACM SIGPLAN Notices10.1145/2775054.269438850:4(531-543)Online publication date: 14-Mar-2015
  • (2015)Asymmetric Memory FencesProceedings of the Twentieth International Conference on Architectural Support for Programming Languages and Operating Systems10.1145/2694344.2694388(531-543)Online publication date: 14-Mar-2015
  • (2013)Characterizing real world bugs causing sequential consistency violationsProceedings of the 5th USENIX Conference on Hot Topics in Parallelism10.5555/3241639.3241647(8-8)Online publication date: 24-Jun-2013
  • (2013)WeeFenceACM SIGARCH Computer Architecture News10.1145/2508148.248594141:3(213-224)Online publication date: 23-Jun-2013
  • (2013)VolitionACM SIGPLAN Notices10.1145/2499368.245117448:4(535-548)Online publication date: 16-Mar-2013
  • (2013)VolitionACM SIGARCH Computer Architecture News10.1145/2490301.245117441:1(535-548)Online publication date: 16-Mar-2013
  • (2013)WeeFenceProceedings of the 40th Annual International Symposium on Computer Architecture10.1145/2485922.2485941(213-224)Online publication date: 23-Jun-2013
  • (2013)Address-aware fencesProceedings of the 27th international ACM conference on International conference on supercomputing10.1145/2464996.2465015(313-324)Online publication date: 10-Jun-2013
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media