Abstract
Concurrent programs are notoriously hard to write correctly, as scheduling nondeterminism introduces subtle errors that are both hard to detect and to reproduce. The most common concurrency errors are (data) races, which occur when memory-conflicting actions are executed concurrently. Consequently, considerable effort has been made towards developing efficient techniques for race detection. The most common approach is dynamic race prediction: given an observed, race-free trace σ of a concurrent program, the task is to decide whether events of σ can be correctly reordered to a trace σ* that witnesses a race hidden in σ.
In this work we introduce the notion of sync(hronization)-preserving races. A sync-preserving race occurs in σ when there is a witness σ* in which synchronization operations (e.g., acquisition and release of locks) appear in the same order as in σ. This is a broad definition that strictly subsumes the famous notion of happens-before races. Our main results are as follows. First, we develop a sound and complete algorithm for predicting sync-preserving races. For moderate values of parameters like the number of threads, the algorithm runs in Õ(N) time and space, where N is the length of the trace σ. Second, we show that the problem has a Ω(N/log2 N) space lower bound, and thus our algorithm is essentially time and space optimal. Third, we show that predicting races with even just a single reversal of two sync operations is NP-complete and even W1-hard when parameterized by the number of threads. Thus, sync-preservation characterizes exactly the tractability boundary of race prediction, and our algorithm is nearly optimal for the tractable side. Our experiments show that our algorithm is fast in practice, while sync-preservation characterizes races often missed by state-of-the-art methods.
- Joaquín Aguado, Michael Mendler, Marc Pouzet, Partha Roop, and Reinhard von Hanxleden. 2018. Deterministic Concurrency: A Clock-Synchronised Shared Memory Approach. In Programming Languages and Systems, Amal Ahmed (Ed.). Springer International Publishing, Cham, 86-113.Google Scholar
- Stephen M. Blackburn, Robin Garner, Chris Hofmann, Asjad M. Khang, Kathryn S. McKinley, Rotem Bentzur, Amer Diwan, Daniel Feinberg, Daniel Frampton, Samuel Z. Guyer, Martin Hirzel, Antony Hosking, Maria Jump, Han Lee, J. Eliot B. Moss, Aashish Phansalkar, Darko Stefanović, Thomas VanDrunen, Daniel von Dincklage, and Ben Wiedermann. 2006. The DaCapo Benchmarks: Java Benchmarking Development and Analysis. In Proceedings of the 21st Annual ACM SIGPLAN Conference on Object-oriented Programming Systems, Languages, and Applications (Portland, Oregon, USA) ( OOPSLA '06). ACM, New York, NY, USA, 169-190. https://doi.org/10.1145/1167473.1167488 Google Scholar
Digital Library
- Robert L. Bocchino, Vikram S. Adve, Sarita V. Adve, and Marc Snir. 2009. Parallel Programming Must Be Deterministic by Default. In Proceedings of the First USENIX Conference on Hot Topics in Parallelism (Berkeley, California) ( HotPar'09). USENIX Association, USA, 4.Google Scholar
Digital Library
- Hans-J. Boehm. 2011. How to Miscompile Programs with “Benign” Data Races. In Proceedings of the 3rd USENIX Conference on Hot Topic in Parallelism (Berkeley, CA) ( HotPar'11). USENIX Association, USA, 3.Google Scholar
Digital Library
- Hans-J. Boehm. 2012. Position Paper: Nondeterminism is Unavoidable, but Data Races Are Pure Evil. In Proceedings of the 2012 ACM Workshop on Relaxing Synchronization for Multicore and Manycore Scalability (Tucson, Arizona, USA) ( RACES '12). Association for Computing Machinery, New York, NY, USA, 9-14. https://doi.org/10.1145/2414729.2414732 Google Scholar
Digital Library
- Michael D. Bond, Katherine E. Coons, and Kathryn S. McKinley. 2010. PACER: Proportional Detection of Data Races. In Proceedings of the 31st ACM SIGPLAN Conference on Programming Language Design and Implementation (Toronto, Ontario, Canada) ( PLDI '10). ACM, New York, NY, USA, 255-268. https://doi.org/10.1145/1806596.1806626 Google Scholar
Digital Library
- Feng Chen, Traian Florin Şerbănuţă, and Grigore Roşu. 2008. jPredictor: a predictive runtime analysis tool for Java. In ICSE '08: Proceedings of the 30th International Conference on Software Engineering (Leipzig, Germany). ACM, New York, NY, USA, 221-230.Google Scholar
Digital Library
- Jong-Deok Choi, Keunwoo Lee, Alexey Loginov, Robert O'Callahan, Vivek Sarkar, and Manu Sridharan. 2002. Eficient and Precise Datarace Detection for Multithreaded Object-oriented Programs. In Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design and Implementation (Berlin, Germany) ( PLDI '02). ACM, New York, NY, USA, 258-269. https://doi.org/10.1145/512529.512560 Google Scholar
Digital Library
- Mark Christiaens and Koenraad De Bosschere. 2001. TRaDe: Data Race Detection for Java. In Proceedings of the International Conference on Computational Science-Part II (ICCS '01). Springer-Verlag, London, UK, UK, 761-770.Google Scholar
Cross Ref
- Heming Cui, Rui Gu, Cheng Liu, Tianyu Chen, and Junfeng Yang. 2015. Paxos Made Transparent. In Proceedings of the 25th Symposium on Operating Systems Principles (Monterey, California) ( SOSP '15). Association for Computing Machinery, New York, NY, USA, 105-120. https://doi.org/10.1145/2815400.2815427 Google Scholar
Digital Library
- Anne Dinning and Edith Schonberg. 1991. Detecting Access Anomalies in Programs with Critical Sections. In Proceedings of the 1991 ACM/ONR Workshop on Parallel and Distributed Debugging (Santa Cruz, California, USA) ( PADD '91). ACM, New York, NY, USA, 85-96. https://doi.org/10.1145/122759.122767 Google Scholar
Digital Library
- Hyunsook Do, Sebastian G. Elbaum, and Gregg Rothermel. 2005. Supporting Controlled Experimentation with Testing Techniques: An Infrastructure and its Potential Impact. Empirical Software Engineering: An International Journal 10, 4 ( 2005 ), 405-435.Google Scholar
Digital Library
- Tayfun Elmas, Shaz Qadeer, and Serdar Tasiran. 2007. Goldilocks: A Race and Transaction-aware Java Runtime. In Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation (San Diego, California, USA) ( PLDI '07). ACM, New York, NY, USA, 245-255. https://doi.org/10.1145/1250734.1250762 Google Scholar
Digital Library
- Eitan Farchi, Yarden Nir, and Shmuel Ur. 2003. Concurrent Bug Patterns and How to Test Them. In Proceedings of the 17th International Symposium on Parallel and Distributed Processing (IPDPS '03). IEEE Computer Society, Washington, DC, USA, 286. 2-.Google Scholar
Digital Library
- Azadeh Farzan and P. Madhusudan. 2009. The Complexity of Predicting Atomicity Violations. In Proceedings of the 15th International Conference on Tools and Algorithms for the Construction and Analysis of Systems: Held As Part of the Joint European Conferences on Theory and Practice of Software, ETAPS 2009, (York, UK) ( TACAS '09). Springer-Verlag, Berlin, Heidelberg, 155-169. https://doi.org/10.1007/978-3-642-00768-2_14 Google Scholar
Digital Library
- Azadeh Farzan, P. Madhusudan, and Francesco Sorrentino. 2009. Meta-analysis for Atomicity Violations Under Nested Locking. In Proceedings of the 21st International Conference on Computer Aided Verification (Grenoble, France) ( CAV '09). Springer-Verlag, Berlin, Heidelberg, 248-262. https://doi.org/10.1007/978-3-642-02658-4_21 Google Scholar
Digital Library
- Colin Fidge. 1991. Logical Time in Distributed Computing Systems. Computer 24, 8 (Aug. 1991 ), 28-33. https://doi.org/10. 1109/2.84874 Google Scholar
Digital Library
- Cormac Flanagan and Stephen N. Freund. 2009. FastTrack: Eficient and Precise Dynamic Race Detection. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (Dublin, Ireland) ( PLDI '09). ACM, New York, NY, USA, 121-133. https://doi.org/10.1145/1542476.1542490 Google Scholar
Digital Library
- Cormac Flanagan, Stephen N. Freund, and Jaeheon Yi. 2008. Velodrome: A Sound and Complete Dynamic Atomicity Checker for Multithreaded Programs. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (Tucson, AZ, USA) ( PLDI '08). ACM, New York, NY, USA, 293-303. https://doi.org/10.1145/1375581. 1375618 Google Scholar
Digital Library
- Kaan Genç, Jake Roemer, Yufan Xu, and Michael D. Bond. 2019. Dependence-Aware, Unbounded Sound Predictive Race Detection. Proc. ACM Program. Lang. 3, OOPSLA, Article 179 (Oct. 2019 ), 30 pages. https://doi.org/10.1145/3360605 Google Scholar
Digital Library
- Kaan Genç, Yufan Xu, and Michael D. Bond. 2020. Personal Communication. ( 2020 ).Google Scholar
- Phillip B. Gibbons and Ephraim Korach. 1997. Testing Shared Memories. SIAM J. Comput. 26, 4 (Aug. 1997 ), 1208-1244. https://doi.org/10.1137/S0097539794279614 Google Scholar
Digital Library
- Nikos Gorogiannis, Peter W. O'Hearn, and Ilya Sergey. 2019. A True Positives Theorem for a Static Race Detector. Proc. ACM Program. Lang. 3, POPL, Article 57 ( Jan. 2019 ), 29 pages. https://doi.org/10.1145/3290370 Google Scholar
Digital Library
- Maurice P. Herlihy and Jeannette M. Wing. 1990. Linearizability: A Correctness Condition for Concurrent Objects. ACM Trans. Program. Lang. Syst. 12, 3 ( July 1990 ), 463-492. https://doi.org/10.1145/78969.78972 Google Scholar
Digital Library
- Jef Huang, Patrick O'Neil Meredith, and Grigore Rosu. 2014. Maximal Sound Predictive Race Detection with Control Flow Abstraction. In Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation (Edinburgh, United Kingdom) (PLDI '14). ACM, New York, NY, USA, 337-348. https://doi.org/10.1145/2594291.2594315 Google Scholar
Digital Library
- Jef Huang and Arun K. Rajagopalan. 2016. Precise and Maximal Race Detection from Incomplete Traces. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications (Amsterdam, Netherlands) ( OOPSLA 2016). ACM, New York, NY, USA, 462-476. https://doi.org/10.1145/2983990.2984024 Google Scholar
Digital Library
- Christian Gram Kalhauge and Jens Palsberg. 2018. Sound Deadlock Prediction. Proc. ACM Program. Lang. 2, OOPSLA, Article 146 (Oct. 2018 ), 29 pages. https://doi.org/10.1145/3276516 Google Scholar
Digital Library
- Baris Kasikci, Cristian Zamfir, and George Candea. 2013. RaceMob: Crowdsourced Data Race Detection. In Proceedings of the Twenty-Fourth ACM Symposium on Operating Systems Principles (Farminton, Pennsylvania) (SOSP '13). ACM, New York, NY, USA, 406-422.Google Scholar
Digital Library
- Dileep Kini, Umang Mathur, and Mahesh Viswanathan. 2017. Dynamic Race Prediction in Linear Time. In Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and Implementation (Barcelona, Spain) ( PLDI 2017). ACM, New York, NY, USA, 157-170. https://doi.org/10.1145/3062341.3062374 Google Scholar
Digital Library
- Leslie Lamport. 1978. Time, Clocks, and the Ordering of Events in a Distributed System. Commun. ACM 21, 7 ( July 1978 ), 558-565.Google Scholar
- Peng Liu, Omer Tripp, and Xiangyu Zhang. 2016. IPA: Improving Predictive Analysis with Pointer Analysis. In Proceedings of the 25th International Symposium on Software Testing and Analysis (Saarbrücken, Germany) (ISSTA 2016 ). Association for Computing Machinery, New York, NY, USA, 59-69. https://doi.org/10.1145/2931037.2931046 Google Scholar
Digital Library
- Shan Lu, Soyeon Park, Eunsoo Seo, and Yuanyuan Zhou. 2008. Learning from Mistakes: A Comprehensive Study on Real World Concurrency Bug Characteristics. In Proceedings of the 13th International Conference on Architectural Support for Programming Languages and Operating Systems (Seattle, WA, USA) (ASPLOS XIII). ACM, New York, NY, USA, 329-339. https://doi.org/10.1145/1346281.1346323 Google Scholar
Digital Library
- Umang Mathur. 2020. RAPID. https://github.com/umangm/rapid Accessed: 2020-10-25.Google Scholar
- Umang Mathur, Dileep Kini, and Mahesh Viswanathan. 2018. What Happens-after the First Race? Enhancing the Predictive Power of Happens-before Based Dynamic Race Detection. Proc. ACM Program. Lang. 2, OOPSLA, Article 145 (Oct. 2018 ), 29 pages. https://doi.org/10.1145/3276515 Google Scholar
Digital Library
- Umang Mathur, Andreas Pavlogiannis, and Mahesh Viswanathan. 2020a. The Complexity of Dynamic Data Race Prediction. In Proceedings of the 35th Annual ACM/IEEE Symposium on Logic in Computer Science (Saarbrücken, Germany) (LICS '20). Association for Computing Machinery, New York, NY, USA, 713-727. https://doi.org/10.1145/3373718.3394783 Google Scholar
Digital Library
- Umang Mathur, Andreas Pavlogiannis, and Mahesh Viswanathan. 2020b. Optimal Prediction of Synchronization-Preserving Races. CoRR abs/ 2010.16385 ( 2020 ). arXiv: 2010.16385 https://arxiv.org/abs/ 2010.16385Google Scholar
- Umang Mathur and Mahesh Viswanathan. 2020. Atomicity Checking in Linear Time Using Vector Clocks. In Proceedings of the Twenty-Fifth International Conference on Architectural Support for Programming Languages and Operating Systems (Lausanne, Switzerland) (ASPLOS '20). Association for Computing Machinery, New York, NY, USA, 183-199. https: //doi.org/10.1145/3373376.3378475 Google Scholar
Digital Library
- Friedemann Mattern. 1988. Virtual Time and Global States of Distributed Systems. In Parallel and Distributed Algorithms. North-Holland, 215-226.Google Scholar
- Satish Narayanasamy, Zhenghao Wang, Jordan Tigani, Andrew Edwards, and Brad Calder. 2007. Automatically Classifying Benign and Harmful Data Races Using Replay Analysis. In Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation (San Diego, California, USA) ( PLDI '07). Association for Computing Machinery, New York, NY, USA, 22-31. https://doi.org/10.1145/1250734.1250738 Google Scholar
Digital Library
- Andreas Pavlogiannis. 2019. Fast, Sound, and Efectively Complete Dynamic Race Prediction. Proc. ACM Program. Lang. 4, POPL, Article 17 ( Dec. 2019 ), 29 pages. https://doi.org/10.1145/3371085 Google Scholar
Digital Library
- Eli Pozniansky and Assaf Schuster. 2003. Eficient On-the-fly Data Race Detection in Multithreaded C++ Programs. In Proceedings of the Ninth ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (San Diego, California, USA) ( PPoPP '03). ACM, New York, NY, USA, 179-190. https://doi.org/10.1145/781498.781529 Google Scholar
Digital Library
- Jake Roemer and Michael D. Bond. 2019. Online Set-Based Dynamic Analysis for Sound Predictive Race Detection. CoRR abs/ 1907.08337 ( 2019 ). arXiv: 1907.08337 http://arxiv.org/abs/ 1907.08337Google Scholar
- Jake Roemer, Kaan Genç, and Michael D. Bond. 2018. High-coverage, Unbounded Sound Predictive Race Detection. In Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (Philadelphia, PA, USA) ( PLDI 2018). ACM, New York, NY, USA, 374-389. https://doi.org/10.1145/3192366.3192385 Google Scholar
Digital Library
- Jake Roemer, Kaan Genç, and Michael D. Bond. 2020. SmartTrack: Eficient Predictive Race Detection. In Proceedings of the 41st ACM SIGPLAN Conference on Programming Language Design and Implementation (London, UK) ( PLDI 2020 ). Association for Computing Machinery, New York, NY, USA, 747-762. https://doi.org/10.1145/3385412.3385993 Google Scholar
Digital Library
- Grigore Rosu. 2018. RV-Predict, Runtime Verification. Accessed: 2018-04-01.Google Scholar
- Mahmoud Said, Chao Wang, Zijiang Yang, and Karem Sakallah. 2011. Generating Data Race Witnesses by an SMTbased Analysis. In Proceedings of the Third International Conference on NASA Formal Methods (Pasadena, CA) ( NFM'11). Springer-Verlag, Berlin, Heidelberg, 313-327.Google Scholar
Digital Library
- Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, and Thomas Anderson. 1997. Eraser: A Dynamic Data Race Detector for Multithreaded Programs. ACM Trans. Comput. Syst. 15, 4 (Nov. 1997 ), 391-411. https://doi.org/10. 1145/265924.265927 Google Scholar
Digital Library
- D. Schonberg. 1989. On-the-fly Detection of Access Anomalies. In Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation (Portland, Oregon, USA) ( PLDI '89). ACM, New York, NY, USA, 285-297. https://doi.org/10.1145/73141.74844 Google Scholar
Digital Library
- Koushik Sen. 2008. Race Directed Random Testing of Concurrent Programs. In Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and Implementation (Tucson, AZ, USA) ( PLDI '08). ACM, New York, NY, USA, 11-21. https://doi.org/10.1145/1375581.1375584 Google Scholar
Digital Library
- Koushik Sen, Grigore Roşu, and Gul Agha. 2005. Detecting Errors in Multithreaded Programs by Generalized Predictive Analysis of Executions. In Proceedings of the 7th IFIP WG 6.1 International Conference on Formal Methods for Open Object-Based Distributed Systems (Athens, Greece) ( FMOODS'05). Springer-Verlag, Berlin, Heidelberg, 211-226.Google Scholar
Digital Library
- Traian Florin Şerbănuţă, Feng Chen, and Grigore Roşu. 2012. Maximal causal models for sequentially consistent systems. In International Conference on Runtime Verification. Springer, 136-150.Google Scholar
- Ilya Sergey. 2019. What Does It Mean for a Program Analysis to Be Sound? https://blog.sigplan.org/ 2019 /08/07/what-does-itmean-for-a-program-analysis-to-be-sound/Google Scholar
- Yannis Smaragdakis, Jacob Evans, Caitlin Sadowski, Jaeheon Yi, and Cormac Flanagan. 2012. Sound Predictive Race Detection in Polynomial Time. In Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (Philadelphia, PA, USA) ( POPL '12). ACM, New York, NY, USA, 387-400. https://doi.org/10.1145/2103656. 2103702 Google Scholar
Digital Library
- L. A. Smith, J. M. Bull, and J. Obdrizalek. 2001. A Parallel Java Grande Benchmark Suite. In SC '01: Proceedings of the 2001 ACM/IEEE Conference on Supercomputing. 6-6. https://doi.org/10.1145/582034.582042 Google Scholar
Digital Library
- Francesco Sorrentino, Azadeh Farzan, and P. Madhusudan. 2010. PENELOPE: Weaving Threads to Expose Atomicity Violations. In Proceedings of the Eighteenth ACM SIGSOFT International Symposium on Foundations of Software Engineering (Santa Fe, New Mexico, USA) ( FSE '10). ACM, New York, NY, USA, 37-46. https://doi.org/10.1145/1882291.1882300 Google Scholar
Digital Library
- Christoph von Praun and Thomas R. Gross. 2001. Object Race Detection. In Proceedings of the 16th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications (Tampa Bay, FL, USA) ( OOPSLA '01). ACM, New York, NY, USA, 70-82. https://doi.org/10.1145/504282.504288 Google Scholar
Digital Library
- Chao Wang, Sudipta Kundu, Malay Ganai, and Aarti Gupta. 2009. Symbolic Predictive Analysis for Concurrent Programs. In Proceedings of the 2nd World Congress on Formal Methods (Eindhoven, The Netherlands) (FM '09). Springer-Verlag, Berlin, Heidelberg, 256-272.Google Scholar
Digital Library
- Misun Yu, Joon-Sang Lee, and Doo-Hwan Bae. 2018. AdaptiveLock: Eficient Hybrid Data Race Detection Based on Real-World Locking Patterns. International Journal of Parallel Programming (04 Jun 2018 ). https://doi.org/10.1007/s10766-018-0579-5 Google Scholar
Cross Ref
- Yuan Yu, Tom Rodehefer, and Wei Chen. 2005. RaceTrack: Eficient Detection of Data Race Conditions via Adaptive Tracking. In Proceedings of the Twentieth ACM Symposium on Operating Systems Principles (Brighton, United Kingdom) (SOSP '05). Association for Computing Machinery, New York, NY, USA, 221-234. https://doi.org/10.1145/1095810.1095832 Google Scholar
Digital Library
- Qi Zhao, Zhengyi Qiu, and Guoliang Jin. 2019. Semantics-Aware Scheduling Policies for Synchronization Determinism. In Proceedings of the 24th Symposium on Principles and Practice of Parallel Programming (Washington, District of Columbia) ( PPoPP '19). Association for Computing Machinery, New York, NY, USA, 242-256. https://doi.org/10.1145/3293883.3295731 Google Scholar
Digital Library
- M. Zhivich and R. K. Cunningham. 2009. The Real Cost of Software Errors. IEEE Security and Privacy 7, 2 (March 2009 ), 87-90. https://doi.org/10.1109/MSP. 2009.56 Google Scholar
Digital Library
Index Terms
Optimal prediction of synchronization-preserving races
Recommendations
Synthesizing racy tests
PLDI '15: Proceedings of the 36th ACM SIGPLAN Conference on Programming Language Design and ImplementationSubtle concurrency errors in multithreaded libraries that arise because of incorrect or inadequate synchronization are often difficult to pinpoint precisely using only static techniques. On the other hand, the effectiveness of dynamic race detectors is ...
Race directed random testing of concurrent programs
PLDI '08Bugs in multi-threaded programs often arise due to data races. Numerous static and dynamic program analysis techniques have been proposed to detect data races. We propose a novel randomized dynamic analysis technique that utilizes potential data race ...
Race directed random testing of concurrent programs
PLDI '08: Proceedings of the 29th ACM SIGPLAN Conference on Programming Language Design and ImplementationBugs in multi-threaded programs often arise due to data races. Numerous static and dynamic program analysis techniques have been proposed to detect data races. We propose a novel randomized dynamic analysis technique that utilizes potential data race ...






Comments