An extensive empirical study on C++ concurrency constructs

ContextNowadays concurrent programming is in large demand. The inherent support for concurrency is therefore increasingly important in programming languages. As for C++, an abundance of standard concurrency constructs have been supported since C++11. However, to date there is little work investigating how these constructs are actually used in developing real software. ObjectiveIn this paper, we perform an extensive empirical study to investigate the actual adoption of C++ concurrency constructs in open-source applications, with the goal to provide useful information for language designers and practitioners to improve the design and use of concurrency constructs. MethodWe first conduct a survey to understand the developers' perception of concurrency constructs. Then, we analyze 492 open-source concurrent applications, comprising 131 million lines of C++ code, to collect the data of the practical adoption of concurrency constructs. Finally, we perform statistical analysis on the collected data and get the quantitative analysis results. ResultsUsing the experimental data, we uncover many interesting findings with respect to the usage of concurrency constructs, the management of synchronization, the relationship between standard concurrency constructs and third-party concurrency constructs, and the difference of applications in using concurrency constructs. For example, we find that: (1) thread-based constructs are significantly more often used to write concurrent programs than atomics-based constructs and task-based constructs; (2) lock-based constructs are significantly more often used to manage synchronization than lock-free constructs and blocking constructs; (3) developers in most projects do not move from third-party concurrency constructs to standard concurrency constructs; and (4) small-size applications introduce concurrency constructs more intensively and more quickly than medium-size applications and large-size applications. ConclusionsThis is the first extensive empirical study on C++ concurrency constructs. The results of this paper should be helpful for designing, teaching, and using C++ concurrency constructs.

[1]  Herb Sutter,et al.  The Free Lunch Is Over A Fundamental Turn Toward Concurrency in Software , 2013 .

[2]  Premkumar T. Devanbu,et al.  Assert Use in GitHub Projects , 2015, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[3]  Marieke Huisman,et al.  How Do Developers Use APIs? A Case Study in Concurrency , 2013, 2013 18th International Conference on Engineering of Complex Computer Systems.

[4]  Gustavo Pinto,et al.  Are Java programmers transitioning to multicore?: a large scale study of java FLOSS , 2011, SPLASH Workshops.

[5]  Emerson R. Murphy-Hill,et al.  The Design Space of Bug Fixes and How Developers Navigate It , 2015, IEEE Transactions on Software Engineering.

[6]  Y. Benjamini,et al.  Controlling the false discovery rate: a practical and powerful approach to multiple testing , 1995 .

[7]  Shan Lu,et al.  What change history tells us about thread synchronization , 2015, ESEC/SIGSOFT FSE.

[8]  Yuming Zhou,et al.  Examining the Potentially Confounding Effect of Class Size on the Associations between Object-Oriented Metrics and Change-Proneness , 2009, IEEE Transactions on Software Engineering.

[9]  Lionel C. Briand,et al.  A systematic and comprehensive investigation of methods to build and evaluate fault prediction models , 2010, J. Syst. Softw..

[10]  Shari Lawrence Pfleeger,et al.  Personal Opinion Surveys , 2008, Guide to Advanced Empirical Software Engineering.

[11]  Martin P. Robillard,et al.  A field study of API learning obstacles , 2011, Empirical Software Engineering.

[12]  Peter Sewell,et al.  Mathematizing C++ concurrency , 2011, POPL '11.

[13]  Akif Günes Koru,et al.  Comparing high-change modules and modules with the highest measurement values in two large-scale open-source products , 2005, IEEE Transactions on Software Engineering.

[14]  Bertrand Meyer,et al.  Design of an empirical study for comparing the usability of concurrent programming languages , 2013, Inf. Softw. Technol..

[15]  Yuming Zhou,et al.  Empirical analysis of network measures for effort-aware fault-proneness prediction , 2016, Inf. Softw. Technol..

[16]  Carlo A. Furia,et al.  A Comparative Study of Programming Languages in Rosetta Code , 2014, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[17]  Bertrand Meyer,et al.  Benchmarking Usability and Performance of Multicore Languages , 2013, 2013 ACM / IEEE International Symposium on Empirical Software Engineering and Measurement.

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

[19]  Audris Mockus,et al.  An empirical study of goto in C code from GitHub repositories , 2015, ESEC/SIGSOFT FSE.

[20]  Emerson R. Murphy-Hill,et al.  Adoption and use of Java generics , 2012, Empirical Software Engineering.

[21]  Yuming Zhou,et al.  An Empirical Study on C++ Concurrency Constructs , 2015, 2015 ACM/IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM).

[22]  Yuming Zhou,et al.  Are Slice-Based Cohesion Metrics Actually Useful in Effort-Aware Post-Release Fault-Proneness Prediction? An Empirical Study , 2015, IEEE Transactions on Software Engineering.

[23]  Susmit Sarkar,et al.  Nitpicking c++ concurrency , 2011, PPDP.

[24]  Yuming Zhou,et al.  An empirical analysis of package-modularization metrics: Implications for software fault-proneness , 2015, Inf. Softw. Technol..

[25]  Gustavo Pinto,et al.  A large-scale study on the usage of Java's concurrent programming constructs , 2015, J. Syst. Softw..

[26]  Danny Dig,et al.  How do developers use parallel libraries? , 2012, SIGSOFT FSE.

[27]  Yuming Zhou,et al.  An empirical study on the adoption of C++ templates: Library templates versus user defined templates , 2014, SEKE.

[28]  Brian Demsky,et al.  CDSchecker: checking concurrent data structures written with C/C++ atomics , 2013, OOPSLA.