Optimizing Threads Schedule Alignments to Expose the Interference Bug Pattern

  • Neelesh Bhattacharya
  • Olfat El-Mahi
  • Etienne Duclos
  • Giovanni Beltrame
  • Giuliano Antoniol
  • Sébastien Le Digabel
  • Yann-Gaël Guéhéneuc
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7515)


Managing and controlling interference conditions in multi-threaded programs has been an issue of worry for application developers for a long time. Typically, when write events from two concurrent threads to the same shared variable are not properly protected, an occurrence of the interference bug pattern could be exposed. We propose a mathematical formulation and its resolution to maximize the possibility of exposing occurrences of the interference bug pattern. We formulate and solve the issue as an optimization problem that gives us (1) the optimal position to inject a delay in the execution flow of a thread and (2) the optimal duration for this delay to align at least two different write events in a multi-threaded program. To run the injected threads and calculate the thread execution times for validating the results, we use a virtual platform modelling a perfectly parallel system. All the effects due to the operating system’s scheduler or the latencies of hardware components are reduced to zero, exposing only the interactions between threads. To the best of our knowledge, no previous work has formalized the alignment of memory access events to expose occurrences of the interference bug pattern. We use three different algorithms (random, stochastic hill climbing, and simulated annealing) to solve the optimization problem and compare their performance. We carry out experiments on four small synthetic programs and three real-world applications with varying numbers of threads and read/write executions. Our results show that the possibility of exposing interference bug pattern can be significantly enhanced, and that metaheuristics (hill climbing and simulated annealing) provide much better results than a random algorithm.


Multi-Threaded Programs Testing Optimization Techniques Interference Bug Pattern 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Artho, C., Havelund, K., Biere, A., Biere, A.: High-level data races. Journal on Software Testing, Verification & Reliability, STVR (2003)Google Scholar
  2. 2.
    Beltrame, G., Fossati, L., Sciuto, D.: ReSP: a nonintrusive transaction-level reflective MPSoC simulation platform for design space exploration. In: Computer-Aided Design of Integrated Circuits and Systems, pp. 28–40 (2009)Google Scholar
  3. 3.
    Ben-Asher, Y., Farchi, E., Eytani, Y.: Heuristics for finding concurrent bugs. In: Proceedings of the 17th International Symposium on Parallel and Distributed Processing, p. 288.1(2003)Google Scholar
  4. 4.
    Bradbury, J.S., Cordy, J.R., Dingel, J.: Mutation operators for concurrent java (j2se 5.0) 1Google Scholar
  5. 5.
    Briand, L.C., Labiche, Y., Shousha, M.: Stress Testing Real-Time Systems with Genetic Algorithms. In: Proceedings of the 2005 Conference on Genetic and Evolutionary Computation (GECCO 2005), pp. 1021–1028 (2005)Google Scholar
  6. 6.
    Briand, L.C., Labiche, Y., Shousha, M.: Using Genetic Algorithms for Early Schedulability Analysis and Stress Testing in Real-Time Systems. Genetic Programming and Evolvable Machines 7, 145–170 (2006)CrossRefGoogle Scholar
  7. 7.
    Carver, R.H., Tai, K.C.: Replay and testing for concurrent programs. IEEE Softw. 8, 66–74 (1991)CrossRefGoogle Scholar
  8. 8.
    Drake, D.G.: A quick tutorial on how to implement threads in java (1996),
  9. 9.
    Edelstein, O., Farchi, E., Goldin, E., Nir, Y., Ratsaby, G., Ur, S.: Framework for testing multi-threaded java programs. Concurrency and Computation: Practice and Experience 15(3-5), 485–499 (2003)zbMATHCrossRefGoogle Scholar
  10. 10.
    Eytani, Y., Ur, S.: Compiling a benchmark of documented multi-threaded bugs. In: Parallel and Distributed Processing Symposium, International, vol. 17, p. 266a (2004)Google Scholar
  11. 11.
    Farchi, E., Nir, Y., Ur, S.: Concurrent bug patterns and how to test them. In: Proceedings of the 17th International Symposium on Parallel and Distributed Processing. p. 286.2 (2003)Google Scholar
  12. 12.
    Flanagan, C., Freund, S.N.: Atomizer: A dynamic atomicity checker for multithreaded programs. Scientific Computer Program 71(2), 89–109 (2008)MathSciNetzbMATHCrossRefGoogle Scholar
  13. 13.
    Godefroid, P.: Model checking for programming languages using verisoft. In: Proceedings of the 24th ACM Symposium on Principles of Programming Languages, pp. 174–186 (1997)Google Scholar
  14. 14.
    Hovemeyer, D., Pugh, W.: Finding bugs is easy. In: ACM SIGPLAN Notices, pp. 132–136 (2004)Google Scholar
  15. 15.
    Hwang, G.H., Chung Tai, K., Lu Huang, T.: Reachability testing: An approach to testing concurrent software. International Journal of Software Engineering and Knowledge Engineering 5, 493–510 (1995)CrossRefGoogle Scholar
  16. 16.
    Joshi, P., Naik, M., Seo Park, C., Sen, K.: Calfuzzer: An extensible active testing framework for concurrent programsGoogle Scholar
  17. 17.
    Lei, Y., Carver, R.H.: Reachability testing of concurrent programs. IEEE Trans. Softw. Eng. 32, 382–403 (2006)CrossRefGoogle Scholar
  18. 18.
    Long, B., Strooper, P., Wildman, L.: A method for verifying concurrent java components based on an analysis of concurrency failures: Research articles. Concurr. Comput.: Pract. Exper. 19, 281–294 (2007)CrossRefGoogle Scholar
  19. 19.
    Metropolis, N., Rosenbluth, A., Rosenbluth, M., Teller, A., Teller, E.: Equation of state calculations by fast computing machines. Journal of Chemical Physics 21, 1087–1092 (1953)CrossRefGoogle Scholar
  20. 20.
    Musuvathi, M., Qadeer, S., Ball, T.: Chess: A systematic testing tool for concurrent software (2007)Google Scholar
  21. 21.
    Park, A.: Multithreaded programming (pthreads tutorial) (1999),
  22. 22.
    Park, S., Lu, S., Zhou, Y.: Ctrigger: exposing atomicity violation bugs from their hiding places. SIGPLAN Not. 44, 25–36 (2009)CrossRefGoogle Scholar
  23. 23.
    Software Quality Research Group, Ontario Institute of Technology: Concurrency anti-pattern catalog for java (2010),
  24. 24.
    Tripakis, S., Stergiou, C., Lublinerman, R.: Checking non-interference in spmd programs. In: 2nd USENIX Workshop on Hot Topics in Parallelism (HotPar 2010), pp. 1–6 (June 2010)Google Scholar
  25. 25.
    Wattenberg, M., Juels, A.: Stochastic hillclimbing as a baseline method for evaluating genetic algorithms. In: Proceedings of the 1995 Conference, vol. 8, p. 430. Kaufmann (1996)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2012

Authors and Affiliations

  • Neelesh Bhattacharya
    • 1
  • Olfat El-Mahi
    • 1
  • Etienne Duclos
    • 1
  • Giovanni Beltrame
    • 1
  • Giuliano Antoniol
    • 1
  • Sébastien Le Digabel
    • 2
  • Yann-Gaël Guéhéneuc
    • 1
  1. 1.Department of Computer and Software EngineeringÉcole Polytechnique de MontréalCanada
  2. 2.GERAD and Department of Mathematics and Industrial EngineeringÉcole Polytechnique de MontréalCanada

Personalised recommendations