Algorithms for Data-Race Detection in Multithreaded Programs

Two parallel accesses to the same location, at least one of which is a write, form a race. Debugging such races is complicated by atomic critical sections. In programs without critical sections, a race is usually a bug causing nondeterminism. In programs with critical sections, however, accesses in parallel critical sections are not considered bugs: the programmer, in specifying the critical sections, presumably intends them to run in parallel. Thus, a race detector should find "data races"---races between accesses not contained in atomic critical sections. We present algorithms for detecting data races in programs written in the Cilk multithreaded language. These algorithms do not verify programs; rather, they find data races in all schedulings of the computation generated when a program executes serially on a given input. The ALL-SETS algorithm checks programs in which atomicity is specified using locks. The UMBRELLA algorithm also checks programs using locks, gaining efficiency by detecting violations of a proposed locking discipline that precludes some race-free locking protocols as well as data races. The REVIEW-GUARDS algorithm checks programs using a proposed ``guard statement'''' language construct to specify atomicity at a higher level than locks. We also extend each algorithm to handle critical sections containing parallelism.

[1]  Edith Schonberg,et al.  An empirical comparison of monitoring algorithms for access anomaly detection , 2011, PPOPP '90.

[2]  Charles E. Leiserson,et al.  Efficient detection of determinacy races in Cilk programs , 1997, SPAA '97.

[3]  P MillerBarton,et al.  What are race conditions , 1992 .

[4]  Keith H. Randall,et al.  Cilk: efficient multithreaded computing , 1998 .

[5]  Robert E. Tarjan,et al.  Applications of Path Compression on Balanced Trees , 1979, JACM.

[6]  Charles E. McDowell,et al.  Analyzing Traces with Anonymous Synchronization , 1989, ICPP.

[7]  Piet Hut,et al.  A hierarchical O(N log N) force-calculation algorithm , 1986, Nature.

[8]  Andrew V. Goldberg,et al.  A new approach to the maximum flow problem , 1986, STOC '86.

[9]  David A. Patterson,et al.  Computer Architecture: A Quantitative Approach , 1969 .

[10]  Jong-Deok Choi,et al.  An efficient cache-based access anomaly detection scheme , 1991, ASPLOS IV.

[11]  Edith Schonberg,et al.  Detecting access anomalies in programs with critical sections , 1991, PADD '91.

[12]  Charles E. Leiserson,et al.  Efficient Detection of Determinacy Races in Cilk Programs , 1997, SPAA '97.

[13]  Charles E. Leiserson,et al.  Detecting data races in Cilk programs that use locks , 1998, SPAA '98.

[14]  Robert H. B. Netzer,et al.  Efficient Race Condition Detection for Shared-Memory Programs with Post/Wait Synchronization , 1992, International Conference on Parallel Processing.

[15]  John M. Mellor-Crummey,et al.  On-the-fly detection of data races for programs with nested fork-join parallelism , 1991, Proceedings of the 1991 ACM/IEEE Conference on Supercomputing (Supercomputing '91).

[16]  Mihalis Yannakakis,et al.  Freedom from Deadlock of Safe Locking Policies , 1982, SIAM J. Comput..

[17]  Bjarne Stroustrup,et al.  C++ Programming Language , 1986, IEEE Softw..

[18]  Peter J. Keleher,et al.  Online data-race detection via coherency guarantees , 1996, OSDI '96.

[19]  Michael Burrows,et al.  Eraser: a dynamic data race detector for multi-threaded programs , 1997, TOCS.

[20]  Barton P. Miller,et al.  On the Complexity of Event Ordering for Shared-Memory Parallel Program Executions , 1990, ICPP.

[21]  David A. Padua,et al.  Event synchronization analysis for debugging parallel programs , 1989, Proceedings of the 1989 ACM/IEEE Conference on Supercomputing (Supercomputing '89).

[22]  Andrew F. Stark,et al.  Debugging Multithreaded Programs that Incorporate User-Level Locking , 1998 .

[23]  Jong-Deok Choi,et al.  A Mechanism for Efficient Debugging of Parallel Programs , 1988, PLDI.