Affiliation:
1. University of California, Berkeley, Berkeley, CA, USA
2. Intel, Berkeley, CA, USA
Abstract
Unintended or unmediated data sharing is a frequent cause of insidious bugs in multithreaded programs. We present a tool called SharC (short for
Sharing Checker
) that allows a user to write lightweight annotations to declare how they believe objects are being shared between threads in their program. SharC uses a combination of static and dynamic analyses to check that the program conforms to this specification.
SharC allows any type to have one of five "sharing modes" -- private to the current thread, read-only, shared under the control of a specified lock, intentionally racy, or checked dynamically. The dynamic mode uses run-time checking to verify that objects are either read-only, or only accessed by one thread. This allows us to check programs that would be difficult to check with a purely static system. If the user does not give a type an explicit annotation, then SharC uses a static type-qualifier analysis to infer that it is either private or should be checked dynamically.
SharC allows objects to move between different sharing modes at runtime by using reference counting to check that there are no other references to the objects when they change mode.
SharC's baseline dynamic analysis can check any C program, but is slow, and will generate false warnings about intentional data sharing. As the user adds more annotations, false warnings are reduced, and performance improves.We have found in practice that very few annotations are needed to describe all sharing and give reasonable performance. We ran SharC on 6 legacy C programs, summing to over 600k lines of code, and found that a total of only 60 simple annotations were needed to remove all false positives and to reduce performance overhead to only 2-14%.
Publisher
Association for Computing Machinery (ACM)
Subject
Computer Graphics and Computer-Aided Design,Software
Reference25 articles.
1. Agarwal R. Sasturkar A. Wang L. and Stoller S. D. Optimized run-time race detection and atomicity checking using partial discovered types. In ASE?05. 10.1145/1101908.1101944 Agarwal R. Sasturkar A. Wang L. and Stoller S. D. Optimized run-time race detection and atomicity checking using partial discovered types. In ASE?05. 10.1145/1101908.1101944
2. Ownership types for safe programming
3. Detecting data races in Cilk programs that use locks
4. Efficient and precise datarace detection for multithreaded object-oriented programs
5. Condit J. Harren M. Anderson Z. Gay D. and Necula G. Dependent types for low-level programming. In ESOP?07. Condit J. Harren M. Anderson Z. Gay D. and Necula G. Dependent types for low-level programming. In ESOP?07.
Cited by
5 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Synchronous Deterministic Parallel Programming for Multi-Cores with ForeC;ACM Transactions on Programming Languages and Systems;2023-06-26
2. Revisiting the Complexity of Hardware Cache Coherence and Some Implications;ACM Transactions on Architecture and Code Optimization;2015-01-09
3. HATI: Hardware Assisted Thread Isolation for Concurrent C/C++ Programs;2014 IEEE International Parallel & Distributed Processing Symposium Workshops;2014-05
4. Æminium;ACM Transactions on Programming Languages and Systems;2014-03
5. Multithreaded Geant4: Semi-automatic Transformation into Scalable Thread-Parallel Software;Euro-Par 2010 - Parallel Processing;2010