Abstract
Ad hoc synchronizations are pervasive in multi-threaded programs. Due to their diversity and complexity, understanding the enforced synchronization relationships of ad hoc synchronizations is challenging but crucial to multi-threaded program development and maintenance. Existing techniques can partially detect primitive ad hoc synchronizations, but they cannot recognize complete implementations or infer the enforced synchronization relationships. In this paper, we propose a framework to automatically identify complex ad hoc synchronizations in full and infer their synchronization relationships. We instantiate the framework with a tool called BarrierFinder, which features various techniques, including program slicing and bounded symbolic execution, to efficiently explore the interleaving space of ad hoc synchronizations within multi-threaded programs and collect execution traces. BarrierFinder then uses these traces to characterize ad hoc synchronizations into different types with a focus on recognizing barriers. Our evaluation shows that BarrierFinder is both effective and efficient in doing this, and BarrierFinder is also helpful for programmers to understand the correctness of their implemented ad hoc synchronizations.
Similar content being viewed by others
References
Andersen LO (1994) Program analysis and specialization for the c programming language. PhD thesis, University of Cophenhagen
Beschastnikh I, Brun Y, Ernst MD, Krishnamurthy A, Anderson TE (2011) Mining temporal invariants from partially ordered logs. In: Managing large-scale systems via the analysis of system logs and the application of machine learning techniques. ACM, New York, NY, USA, SLAML ’11, 3:1-3:10. https://doi.org/10.1145/2038633.2038636
Beschastnikh I, Brun Y, Ernst MD, Krishnamurthy A (2014) Inferring models of concurrent systems from logs of their behavior with csight. In: Proceedings of the 36th International Conference on Software Engineering, ACM, New York, NY, USA, ICSE 2014, pp 468–479, DOI https://doi.org/10.1145/2568225.2568246, (to appear in print)
Bessey A, Block K, Chelf B, Chou A, Fulton B, Hallem S, Henri-Gros C, Kamsky A, McPeak S, Engler D (2010) A few billion lines of code later: Using static analysis to find bugs in the real world. Commun ACM 53(2):66–75. https://doi.org/10.1145/1646353.1646374
Bindal S, Bansal S, Lal A (2013) Variable and thread bounding for systematic testing of multithreaded programs. In: Proceedings of the 2013 International Symposium on Software Testing and Analysis, ACM, New York, NY, USA, ISSTA 2013, 145–155. https://doi.org/10.1145/2483760.2483764
Blum B, Gibson G (2016) Stateless model checking with data-race preemption points. In: Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, ACM, New York, NY, USA, OOPSLA 2016, 477–493, https://doi.org/10.1145/2983990.2984036
Bucur S, Ureche V, Zamfir C, Candea G (2011) Parallel symbolic execution for automated real-world software testing. In: Proceedings of the sixth conference on Computer systems. ACM, pp 183–198
Chalupa M, Chatterjee K, Pavlogiannis A, Sinha N, Vaidya K (2017) Data-centric dynamic partial order reduction. Proc ACM Program Lang 2(POPL):31:1–31:30. https://doi.org/10.1145/3158119
Chen C, Huo W, Feng X (2012) Making it practical and effective: Fast and precise may-happen-in-parallel analysis. In: Proceedings of the 21st international conference on parallel architectures and compilation techniques. ACM, New York, NY, USA, PACT ’12, 469–470. https://doi.org/10.1145/2370816.2370900
Chen G, Stenstrom P (2012) Critical lock analysis: Diagnosing critical section bottlenecks in multithreaded applications. In: Proceedings of the international conference on high performance computing, networking, storage and analysis. IEEE Computer Society Press, Los Alamitos, CA, USA, SC ’12, 71:1–71:11. http://dl.acm.org/citation.cfm?id=2388996.2389093
IBM corporation (1998) Software models for multithreaded programming. http://www-01.ibm.com/software/network/dce/library/publications/dceaix_22/a3u2j/A3U2JM53.HTM
Cui H, Simsa J, Lin Y-H, Li H, Blum B, Xu X, Yang J, Gibson G, Bryant RE (2013) Parrot: A practical runtime for deterministic, stable, and reliable threads. In: Proceedings of the Twenty-Fourth ACM Symposium on operating systems principles, association for computing machinery, New York, NY, USA, SOSP ’13, 388–405. https://doi.org/10.1145/2517349.2522735
Das M, Southern G, Renau J (2015) Section-based program analysis to reduce overhead of detecting unsynchronized thread communication. ACM Trans Archit Code Optim 12(2):23:23:1–23:23:26. https://doi.org/10.1145/2766451
Di P, Sui Y, Ye D, Xue J (2015) Region-based may-happen-in-parallel analysis for c programs. In: Parallel Processing (ICPP), 2015 44th International Conference on, pp 889–898. https://doi.org/10.1109/ICPP.2015.98
Ernst MD, Perkins JH, Guo PJ, McCamant S, Pacheco C, Tschantz MS, Xiao C (2007) The daikon system for dynamic detection of likely invariants. Sci Comput Program 69(1):35–45
Farchi E, Nir Y, Ur S (2003) Concurrent bug patterns and how to test them. In: Parallel and distributed processing symposium, 2003. Proceedings. International. IEEE, pp 7–pp
Gallagher KB (2004) Some notes on interprocedural program slicing. In: Source Code Analysis and Manipulation, 2004. Fourth IEEE International Workshop on, pp 36–42. https://doi.org/10.1109/SCAM.2004.21
Giffhorn D, Hammer C (2009) Precise slicing of concurrent programs. Automated Software Engg 16 (2):197–234. https://doi.org/10.1007/s10515-009-0048-x
Gu R, Jin G, Song L, Zhu L, Lu S (2015) What change history tells us about thread synchronization. In: Proceedings of the 2015 10th Joint Meeting on Foundations of Software Engineering, ACM, New York, NY, USA, ESEC/FSE 2015, pp 426–438. https://doi.org/10.1145/2786805.2786815. http://doi.acm.org.prox.lib.ncsu.edu/10.1145/2786805.2786815
Hardekopf B, Lin C (2007) The ant and the grasshopper: Fast and accurate pointer analysis for millions of lines of code. In: Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, New York, NY, USA, PLDI ’07, 290–299. https://doi.org/10.1145/1250734.1250767
Herb S (2005) The free lunch is over: A fundamental turn toward concurrency in software. http://www.gotw.ca/publications/concurrency-ddj.htm
Hind M, Pioli A (2000) Which pointer analysis should i use? In: Proceedings of the 2000 ACM SIGSOFT International Symposium on Software Testing and Analysis, ACM, New York, NY, USA, ISSTA ’00, 113–123 https://doi.org/10.1145/347324.348916
Horwitz S, Reps T, Binkley D (1990) Interprocedural slicing using dependence graphs. ACM Trans Program Lang Syst 12(1):26–60. https://doi.org/10.1145/77606.77608
Jannesari A, Tichy WF (2010) Identifying ad-hoc synchronization for enhanced race detection. In: 2010 IEEE International Symposium on Parallel & Distributed Processing (IPDPS). IEEE, pp 1–10
Jannesari A, Tichy WF (2014) Library-independent data race detection. IEEE Transactions on Parallel and Distributed Systems 25(10):2606–2616
Jin G, Song L, Zhang W, Lu S, Liblit B (2011) Automated atomicity-violation fixing. In: Proceedings of the 32Nd ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, New York, NY, USA, PLDI ’11, 389–400 https://doi.org/10.1145/1993498.1993544
Jin G, Zhang W, Deng D, Liblit B, Lu S (2012) Automated concurrency-bug fixing. In: Proceedings of the 10th USENIX Conference on Operating Systems Design and Implementation, USENIX Association, Berkeley, CA, USA, OSDI’12, pp 221–236. http://dl.acm.org/citation.cfm?id=2387880.2387902
Kamil A, Yelick K (2006) Concurrency analysis for parallel programs with textually aligned barriers. In: Proceedings of the 18th International conference on languages and compilers for parallel computing, Springer, Berlin, Heidelberg, LCPC’05, pp 185–199 https://doi.org/10.1007/978-3-540-69330-7_13
Krinke J (2003) Context-sensitive slicing of concurrent programs. In: Proceedings of the 9th European Software Engineering Conference Held Jointly with 11th ACM SIGSOFT International Symposium on Foundations of Software Engineering, ACM, New York, NY, USA, ESEC/FSE-11, pp 178–187. https://doi.org/10.1145/940071.940096
Lee D, Chen PM, Flinn J, Narayanasamy S (2012) Chimera: Hybrid Program Analysis for Determinism. In: Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, New York, NY, USA, PLDI ’12, pp 463–474. https://doi.org/10.1145/2254064.2254119
Li L, Verbrugge C (2005) A Practical MHP Information Analysis for Concurrent Java Programs. Springer, Berlin, pp 194–208. https://doi.org/10.1007/11532378_15
Lu S, Park S, Seo E, Zhou Y (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, ACM, New York, NY, USA, ASPLOS XIII, pp 329–339. https://doi.org/10.1145/1346281.1346323
Lucia B, Ceze L, Strauss K (2010) Colorsafe: Architectural support for debugging and dynamically avoiding multi-variable atomicity violations. In: Proceedings of the 37th Annual International Symposium on Computer Architecture, ACM, New York, NY, USA, ISCA ’10, pp 222–233. https://doi.org/10.1145/1815961.1815988
Malkis A, Banerjee A (2014) On automation in the verification of software barriers: Experience report. J Autom Reason 52(3):275–329. https://doi.org/10.1007/s10817-013-9290-9
Mazurkiewicz A (1987) Trace theory. In: Advances in Petri Nets 1986, Part II on Petri Nets: Applications and Relationships to Other Models of Concurrency. Springer, New York, Inc., New York, pp 279–324. http://dl.acm.org/citation.cfm?id=25542.25553
Musuvathi M, Qadeer S (2007) Iterative context bounding for systematic testing of multithreaded programs. In: Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, New York , PLDI ’07, pp 446–455. https://doi.org/10.1145/1250734.1250785
Nanda MG, Ramesh S (2006) Interprocedural slicing of multithreaded programs with applications to java. ACM Trans Program Lang Syst 28(6):1088–1144. https://doi.org/10.1145/1186632.1186636
Park S, Lu S, Zhou Y (2009) Ctrigger: Exposing atomicity violation bugs from their hiding places. In: Proceedings of the 14th International conference on architectural support for programming languages and operating systems. ACM, New York, NY, USA, ASPLOS XIV, 25–36, DOI https://doi.org/10.1145/1508244.1508249https://doi.org/10.1145/1508244.1508249, (to appear in print)
Pinto G, Torres W, Fernandes B, Castor F, Barros RS (2015) A large-scale study on the usage of java’s concurrent programming constructs. J Syst Softw 106(C):59–81. https://doi.org/10.1016/j.jss.2015.04.064
Raman R, Zhao J, Sarkar V, Vechev M, Yahav E (2012) Scalable and precise dynamic datarace detection for structured parallelism. In: Proceedings of the 33rd ACM SIGPLAN Conference on Programming Language Design and Implementation, ACM, New York, NY, USA, PLDI ’12, pp 531–542. https://doi.org/10.1145/2254064.2254127
Sadowski C, Yi J (2014) How developers use data race detection tools. In: Proceedings of the 5th Workshop on evaluation and usability of programming languages and tools. ACM, New York, NY, USA, PLATEAU ’14, pp 43–51. https://doi.org/10.1145/2688204.2688205
Shapiro M, Horwitz S (1997) Fast and accurate flow-insensitive points-to analysis. In: Proceedings of the 24th ACM SIGPLAN-SIGACT Symposium on principles of programming languages. ACM, New York, NY, USA, POPL ’97, pp 1–14. https://doi.org/10.1145/263699.263703
Slaby J (2015) Llvm slicer. https://github.com/jirislaby/LLVMSlicer
Steensgaard B (1996) Points-to analysis in almost linear time. In: Proceedings of the 23rd ACM SIGPLAN-SIGACT Symposium on principles of programming languages. ACM, New York, NY, USA, POPL ’96, pp 32–41 https://doi.org/10.1145/237721.237727
Surendran R, Raman R, Chaudhuri S, Mellor-Crummey J, Sarkar V (2014) Test-driven repair of data races in structured parallel programs. In: Proceedings of the 35th ACM SIGPLAN Conference on Programming Language Design and Implementation. ACM, New York, NY, USA, PLDI ’14, pp 15–25. https://doi.org/10.1145/2594291.2594335
Sutter H, Larus J (2005) Software and the concurrency revolution. Queue 3(7):54–62. https://doi.org/10.1145/1095408.1095421
Taubenfeld G (2006) Synchronization algorithms and concurrent programming. Prentice-Hall, Inc, Upper Saddle River
Tian C, Nagarajan V, Gupta R, Tallam S (2008) Dynamic recognition of synchronization operations for improved data race detection. In: Proceedings of the 2008 international symposium on Software testing and analysis. ACM, pp 143–154
Tian C, Nagarajan V, Gupta R, Tallam S (2009) Automated dynamic detection of busy–wait synchronizations. Software: Practice and Experience 39(11):947–972
Wang C, Chaudhuri S, Gupta A, Yang Y (2009) Symbolic pruning of concurrent program executions. In: Proceedings of the the 7th Joint Meeting of the European Software Engineering Conference and the ACM SIGSOFT Symposium on The Foundations of Software Engineering, ACM, New York, NY, USA, ESEC/FSE ’09, p 23–32, https://doi.org/10.1145/1595696.1595702
Wang T (2020) Software package for barrierfinder reproduction. https://doi.org/10.5281/zenodo.3902595
Wang T, Yu X, Qiu Z, Jin G, Mueller F (2019) Barrierfinder: Recognizing ad hoc barriers. In: 2019 IEEE International Conference on Software Maintenance and Evolution (ICSME), pp 323–327 https://doi.org/10.1109/ICSME.2019.00049
Weiser M (1981) Program slicing. In: Proceedings of the 5th international conference on Software engineering. IEEE Press, pp 439–449
Weiser M (1984) Program slicing. IEEE Trans Softw Eng SE-10 (4):352–357. https://doi.org/10.1109/TSE.1984.5010248
Woo SC, Ohara M, Torrie E, Singh JP, Gupta A (1995) The splash-2 programs: Characterization and methodological considerations. In: Proceedings of the 22nd Annual International Symposium on Computer Architecture, ACM, New York, NY, USA, ISCA ’95, pp 24–36 https://doi.org/10.1145/223982.223990
Wu D, Chen L, Zhou Y, Xu B (2016) An extensive empirical study on c++ concurrency constructs. Inf Softw Technol 76:1–18
Xiong W, Park S, Zhang J, Zhou Y, Ma Z (2010) Ad hoc synchronization considered harmful. In: Proceedings of the 9th USENIX Conference on operating systems design and implementation. USENIX Association, Berkeley, CA, USA, OSDI’10, pp 163–176. http://dl.acm.org/citation.cfm?id=1924943.1924955
Yin L (2013) Effectively recognize ad hoc synchronizations with static analysis. In: International Workshop on Languages and Compilers for Parallel Computing, Springer, pp 187–201
Yu T, Pradel M (2016) Syncprof: Detecting, localizing, and optimizing synchronization bottlenecks. In: Proceedings of the 25th International Symposium on Software Testing and Analysis, ACM, New York, NY, USA, ISSTA 2016, pp 389–400, https://doi.org/10.1145/2931037.2931070
Yu X, Joshi P, Xu J, Jin G, Zhang H, Jiang G (2016) Cloudseer: Workflow monitoring of cloud infrastructures via interleaved logs. In: Proceedings of the Twenty-First International Conference on Architectural Support for Programming Languages and Operating Systems, ACM, New York, NY, USA, ASPLOS ’16, pp 489–502 https://doi.org/10.1145/2872362.2872407
Yuan X, Wang Z, Wu C, Yew P-C, Wang W, Li J, Xu D (2013) Synchronization identification through on-the-fly test. In: Proceedings of the 19th International Conference on Parallel Processing, Springer, Berlin, Heidelberg, Euro-Par’13, pp 4–15, https://doi.org/10.1007/978-3-642-40047-6_3
Zhang W, Sun C, Lu S (2010) Conmem: Detecting severe concurrency bugs through an effect-oriented approach. In: Proceedings of the Fifteenth Edition of ASPLOS on Architectural Support for Programming Languages and Operating Systems, ACM, New York, NY, USA, ASPLOS XV, pp 179–192, https://doi.org/10.1145/1736020.1736041
Zhang W, Lim J, Olichandran R, Scherpelz J, Jin G, Lu S, Reps T (2011) Conseq: Detecting concurrency bugs through sequential errors. In: Proceedings of the Sixteenth International conference on architectural support for programming languages and operating systems, ACM, New York, NY, USA, ASPLOS XVI, 251–264, https://doi.org/10.1145/1950365.1950395
Zhang Y, Duesterwald E, Gao GR (2008) Concurrency analysis for shared memory programs with textually unaligned barriers. In: Adve V, Garzarán MJ, Petersen P (eds) Languages and compilers for parallel computing. Springer Berlin, pp 95–109 https://doi.org/10.1007/978-3-540-85261-2_7
Zhao Q, Qiu Z, Jin G (2019) Semantics-aware scheduling policies for synchronization determinism. In: Proceedings of the 24th Symposium on Principles and Practice of Parallel Programming, Association for Computing Machinery, New York, NY, USA, PPoPP ’19, p 242–256 https://doi.org/10.1145/3293883.3295731https://doi.org/10.1145/3293883.3295731
Author information
Authors and Affiliations
Corresponding authors
Additional information
Communicated by: Martin Monperrus
Publisher’s note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
This work was supported in part by the following grants: Air Force Office of Scientific Research AFOSR-FA9550-12-1-0442 and AFOSR-FA9550-17-1-0205, NSF 1217748 and 1525609, DOE 1403482, Lawrence Livermore National Laboratory subcontracts LLNL-B627261 and LLNL-B631308.
Rights and permissions
About this article
Cite this article
Wang, T., Yu, X., Qiu, Z. et al. BarrierFinder: recognizing ad hoc barriers. Empir Software Eng 25, 4676–4706 (2020). https://doi.org/10.1007/s10664-020-09862-3
Published:
Issue Date:
DOI: https://doi.org/10.1007/s10664-020-09862-3