Memory-Model-Sensitive Data Race Analysis

  • Yue Yang
  • Ganesh Gopalakrishnan
  • Gary Lindstrom
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3308)

Abstract

We present a “memory-model-sensitive” approach to validating correctness properties for multithreaded programs. Our key insight is that by specifying both the inter-thread memory consistency model and the intra-thread program semantics as constraints, a program verification task can be reduced to an equivalent constraint solving problem, thus allowing an exhaustive examination of all thread interleavings precisely allowed by a given memory model. To demonstrate, this paper formalizes race conditions according to the new Java memory model, for a simplified but non-trivial source language. We then describe the implementation of a memory-model-sensitive race detector using constraint logic programming (CLP). In comparison with conventional program analysis, our approach does not offer the same kind of performance and scalability due to the complexity involved in exact formal reasoning. However, we show that a formal semantics can serve more than documentation purposes — it can be applied as a sound basis for rigorous property checking, upon which more scalable methods can be derived.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Lamport, L.: How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Transactions on Computers 28(9), 690–691 (1979)MATHCrossRefGoogle Scholar
  2. 2.
    Adve, S.V., Gharachorloo, K.: Shared memory consistency models: A tutorial. IEEE Computer 29(12), 66–76 (1996)Google Scholar
  3. 3.
    Pugh, W.: The Java memory model is fatally flawed. Concurrency: Practice and Experience 12(1), 1–11 (2000)CrossRefMathSciNetGoogle Scholar
  4. 4.
    JSR133: Java memory model and thread specification, http://www.cs.umd.edu/~pugh/java/memoryModel
  5. 5.
    Yang, Y., Gopalakrishnan, G., Lindstrom, G., Slind, K.: Nemos: A framework for axiomatic and executable specifications of memory consistency models. In: Proceedings of the 18th International Parallel and Distributed Processing Symposium (IPDPS) (April 2004)Google Scholar
  6. 6.
    Yang, Y., Gopalakrishnan, G., Lindstrom, G., Slind, K.: Analyzing the Intel Itanium memory ordering rules using logic programming and SAT. In: Geist, D., Tronci, E. (eds.) CHARME 2003. LNCS, vol. 2860, pp. 81–95. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  7. 7.
    Adve, S.V., Hill, M.D., Miller, B.P., Netzer, R.H.B.: Detecting data races on weak memory systems. In: Proceedings of the 18th International Symposium on Computer Architecture (ISCA), pp. 234–243 (1991)Google Scholar
  8. 8.
    Lamport, L.: Time, clocks and ordering of events in distributed systems. Communications of the ACM 21, 558–565 (1978)MATHCrossRefGoogle Scholar
  9. 9.
  10. 10.
    Jaffar, J., Lassez, J.-L.: Constraint logic programming. In: Principles Of Programming Languages, Munich, Germany (January 1987)Google Scholar
  11. 11.
    Netzer, R.H.B.: Race condition detection for debugging shared-memory parallel programs. Technical Report CS-TR-1991-1039 (1991)Google Scholar
  12. 12.
    Gopalakrishnan, G., Yang, Y., Sivaraj, H.: QB or not QB: An efficient execution verification tool for memory orderings. In: Alur, R., Peled, D.A. (eds.) CAV 2004. LNCS, vol. 3114, pp. 401–413. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  13. 13.
    Aiken, A., Fähndrich, M., Su, Z.: Detecting races in relay ladder logic programs. In: Steffen, B. (ed.) TACAS 1998. LNCS, vol. 1384, pp. 184–200. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  14. 14.
    Gagnon, E., Hendren, L.J., Marceau, G.: Efficient inference of static types for java bytecode. In: Static Analysis Symposium, pp. 199–219 (2000)Google Scholar
  15. 15.
    Rountev, A., Milanova, A., Ryder, B.G.: Points-to analysis for Java using annotated constraints. In: Proceedings of Object-Oriented Programming Systems, Lanuages, and Applications, pp. 43–55 (2001)Google Scholar
  16. 16.
    Flanagan, C.: Automatic software model checking using CLP. In: Degano, P. (ed.) ESOP 2003. LNCS, vol. 2618, pp. 189–203. Springer, Heidelberg (2003)CrossRefGoogle Scholar
  17. 17.
    Havelund, K., Pressburger, T.: Model checking JAVA programs using JAVA PathFinder. International Journal on Software Tools for Technology Transfer 2(4), 366–381 (2000)MATHCrossRefGoogle Scholar
  18. 18.
    Visser, W., Havelund, K., Brat, G., Park, S.: Java PathFinder - second generation of a Java Model Checker. In: Post-CAV Workshop on Advances in Verification, Chicago (2000)Google Scholar
  19. 19.
    Corbett, J.C., Dwyer, M.B., Hatcliff, J., Laubach, S., Pasareanu, C.S., Robby, Zheng, H.: Bandera: extracting finite-state models from Java source code. In: International Conference on Software Engineering (2000)Google Scholar
  20. 20.
    Park, D., Stern, U., Dill, D.: Java model checking. In: Proceedings of the First International Workshop on Automated Program Analysis, Testing and Verification, Limerick, Ireland (2000)Google Scholar
  21. 21.
    Netzer, R.H., Miller, B.P.: What are race conditions? Some issues and formalizations. ACM Letters on Programming Languages and Systems 1(1), 74–88 (1992)CrossRefGoogle Scholar
  22. 22.
    Adve, S.V., Hill, M.D.: A unified formalization of four shared-memory models. IEEE Trans. on Parallel and Distributed Systems 4(6), 613–624 (1993)CrossRefGoogle Scholar
  23. 23.
    Dinning, A., Schonberg, E.: Detecting access anomalies in programs with critical sections. In: Proceedings of the ACM/ONR Workshop on Parallel and Distributed Debugging, pp. 85–96 (1991)Google Scholar
  24. 24.
    Perkovic, D., Keleher, P.: Online data-race detection via coherency guarantees. In: Proceedings of the 2nd Symposium on Operating Systems Design and Implementation (OSDI 1996), pp. 47–57 (1996)Google Scholar
  25. 25.
    Min, S.L., Choi, J.-D.: An efficient cache-based access anomaly detection scheme. In: Proceedings of the 4th International Conference on Architectural Support for Programming Languages and Operating System (ASPLOS), pp. 235–244 (1991)Google Scholar
  26. 26.
    Richards, B., Larus, J.R.: Protocol-based data-race detection. In: Proceedings of the SIGMETRICS symposium on Parallel and distributed tools (1998)Google Scholar
  27. 27.
    Schonberg, E.: On-the-fly detection of access anomalies. In: Proceedings of PLDI, pp. 285–297 (1989)Google Scholar
  28. 28.
    Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., Anderson, T.: Eraser: A dynamic data race detector for multithreaded programs. ACM Transactions on Computer Systems 15(4), 391–411 (1997)CrossRefGoogle Scholar
  29. 29.
    von Praun, C., Gross, T.: Object-race detection. In: Proceedings of Object-Oriented Programming Systems, Lanuages, and Applications, pp. 70–82 (2001)Google Scholar
  30. 30.
    Choi, J., Lee, K., Loginov, A., O’Callahan, R., Sarkar, V., Sridharan, M.: Efficient and precise datarace detection for multithreaded object-oriented programs. In: Proceedings of PLDI (2002)Google Scholar
  31. 31.
    Flanagan, C., Leino, K., Lillibridge, M., Nelson, C., Saxe, J., Stata, R.: Extended static checking for Java (2002)Google Scholar
  32. 32.
    Sterling, N.: Warlock - a static data race analysis tool. In: USENIX Winter Technical Conference, pp. 97–106 (1993)Google Scholar
  33. 33.
    Flanagan, C., Freund, S.N.: Type-based race detection for Java. In: Proceedings of PLDI, pp. 219–232 (2000)Google Scholar
  34. 34.
    Bacon, D.F., Strom, R.E., Tarafdar, A.: Guava: a dialect of Java without data races. In: Proceedings of Object-Oriented Programming Systems, Lanuages, and Applications (2000)Google Scholar
  35. 35.
    Boyapati, C., Rinard, M.: A parameterized type system for race-free Java programs. In: Proceedings of Object-Oriented Programming, Systems, Languages, and Applications (2001)Google Scholar
  36. 36.
    Melham, T.F., Gordon, M.J.C.: Introduction to HOL: A theorem proving environment for higher order logic. Cambridge University Press, Cambridge (1993)MATHGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Yue Yang
    • 1
  • Ganesh Gopalakrishnan
    • 2
  • Gary Lindstrom
    • 2
  1. 1.Microsoft Research, One Microsoft WayRedmond
  2. 2.School of ComputingUniversity of UtahSalt Lake City

Personalised recommendations