Advertisement

Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring

  • Rahul Agarwal
  • Liqiang Wang
  • Scott D. Stoller
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3875)

Abstract

Concurrent programs are notorious for containing errors that are difficult to reproduce and diagnose. A common kind of concurrency error is deadlock, which occurs when a set of threads is blocked each trying to acquire a lock held by another thread in that set. Static and dynamic (run-time) analysis techniques exist to detect deadlocks.

Havelund’s GoodLock algorithm detects potential deadlocks at run-time. However, it detects only potential deadlocks involving exactly two threads. This paper presents a generalized version of the GoodLock algorithm that detects potential deadlocks involving any number of threads. Run-time checking may miss errors in unexecuted code. On the positive side, run-time checking generally produces fewer false alarms than static analysis.

This paper explores the use of static analysis to automatically reduce the overhead of run-time checking. We extend our type system, Extended Parameterized Atomic Java (EPAJ), which ensures absence of races and atomicity violations, with Boyapati et al.’s deadlock types. We give an algorithm that infers deadlock types for a given program and an algorithm that determines, based on the result of type inference, which run-time checks can safely be omitted. The new type system, called Deadlock-Free EPAJ (DEPAJ), has the added benefit of giving stronger atomicity guarantees than previous atomicity type systems.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. [AS04]
    Agarwal, R., Stoller, S.D.: Type inference for parameterized race-free Java. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 149–160. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  2. [ASS04]
    Agarwal, R., Sasturkar, A., Stoller, S.D.: Type discovery for parameterized race-free Java. Technical Report DAR-04-16, Computer Science Department, SUNY at Stony Brook (September 2004) Google Scholar
  3. [ASWS05]
    Agarwal, R., Sasturkar, A., Wang, L., Stoller, S.D.: Optimized run-time race detection and atomicity checking using partial discovered types. In: Proc. 20th IEEE/ACM International Conference on Automated Software Engineering (ASE), November 2005. ACM Press, New York (2005)Google Scholar
  4. [AWS05]
    Agarwal, R., Wang, L., Stoller, S.D.: Detecting potential deadlocks with static analysis and runtime monitoring. Technical Report DAR-05-25, Computer Science Department, SUNY at Stony Brook (September 2005), Available at, http://www.cs.sunysb.edu/-ragarwal/deadlock/
  5. [BH05]
    Bensalem, S., Havelund, K.: Scalable deadlock analysis of multithreaded programs. In: Proceedings of the Parallel and Distributed Systems: Testing and Debugging (PADTAD) Track of the 2005 IBM Verification Conference. Springer, Heidelberg (2005)Google Scholar
  6. [BLR02]
    Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe programming: Preventing data races and deadlocks. In: Proc. 17th ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), pp. 211–230, November 2002 (2002) Google Scholar
  7. [BR01]
    Boyapati, C., Rinard, M.C.: A parameterized type system for race-free Java programs. In: Proc. 16th ACM Conference on Object- Oriented Programming, Systems, Languages and Applications (OOPSLA). SIGPLAN Notices, vol. 36(11), pp. 56–69. ACM Press, New York (2001)CrossRefGoogle Scholar
  8. [CLL+02]
    Choi, J.-D., Lee, K., Loginov, A., O’Callahan, R., Sarkar, V., Sridharan, M.: Efficient and precise datarace detection for multithreaded object-oriented programs. In: Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pp. 258–269. ACM Press, New York (2002)Google Scholar
  9. [EA03]
    Engler, D.R., Ashcraft., K.: RacerX: Effective, static detection of race conditions and deadlocks. In: Proc. 24th ACM Symposium on Operating System Principles, pp. 237–252. ACM Press, New York (2003)Google Scholar
  10. [EFG+03]
    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)CrossRefzbMATHGoogle Scholar
  11. [FF00]
    Flanagan, C., Freund, S.: Type-based race detection for Java. In: Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pp. 219–232. ACM Press, New York (2000)Google Scholar
  12. [FF04]
    Flanagan, C., Freund, S.: Type inference against races. In: Giacobazzi, R. (ed.) SAS 2004. LNCS, vol. 3148, pp. 116–132. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  13. [FNBU]
    Farchi, E., Nir-Buchbinder, Y., Ur, S.: Cross-run lock discipline checker for java. In: Tool proposal for IBM Verification Conference (2005) Google Scholar
  14. [FQ03]
    Flanagan, C., Qadeer, S.: A type and effect system for atomicity. In: Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pp. 338–349. ACM Press, New York (2003)Google Scholar
  15. [Har00]
    Harrow, J.J.: Runtime checking of multithreaded applications with Visual Threads. In: Havelund, K., Penix, J., Visser, W. (eds.) SPIN 2000. LNCS, vol. 1885, pp. 331–342. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  16. [Hav00]
    Havelund, K.: Using runtime analysis to guide model checking of java programs. In: Havelund, K., Penix, J., Visser, W. (eds.) SPIN 2000. LNCS, vol. 1885, pp. 245–264. Springer, Heidelberg (2000)CrossRefGoogle Scholar
  17. [HRD04]
    Hatcliff, J., Robby, Dwyer, M.B.: Verifying atomicity specifications for concurrent object-oriented software using model checking. In: Steffen, B., Levi, G. (eds.) VMCAI 2004. LNCS, vol. 2937, pp. 175–190. Springer, Heidelberg (2004)CrossRefGoogle Scholar
  18. [Lip75]
    Lipton, R.J.: Reduction: A method of proving properties of parallel programs. Communications of the ACM 18(12), 717–721 (1975)MathSciNetCrossRefzbMATHGoogle Scholar
  19. [SAWS05]
    Sasturkar, A., Agarwal, R., Wang, L., Stoller, S.D.: Automated type-based analysis of data races and atomicity. In: Proc. ACM SIGPLAN 2005 Symposium on Principles and Practice of Parallel Programming (PPoPP). ACM Press, New York (2005)Google Scholar
  20. [vP04]
    von Praun, C.: Detecting Synchronization Defects in Multi-Threaded Object-Oriented Programs. PhD thesis, ETH Zürich (2004) Google Scholar
  21. [vPG01]
    von Praun, C., Gross, T.R.: Object race detection. In: Proc. 16th ACM Conference on Object-Oriented Programming, Systems, Languages and Applications (OOPSLA), SIGPLAN Notices, vol. 36(11), pp. 70–82. ACM Press, New York (2001)CrossRefGoogle Scholar
  22. [WTE05]
    Williams, A., Thies, W., Ernst, M.D.: Static deadlock detection for Java libraries. In: Black, A.P. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 602–629. Springer, Heidelberg (2005)CrossRefGoogle Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2006

Authors and Affiliations

  • Rahul Agarwal
    • 1
  • Liqiang Wang
    • 1
  • Scott D. Stoller
    • 1
  1. 1.Computer Science Dept.SUNY at Stony BrookStony BrookUSA

Personalised recommendations