Skip to main content

Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring

  • Conference paper
Hardware and Software, Verification and Testing (HVC 2005)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 3875))

Included in the following conference series:

  • 691 Accesses

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.

This work was supported in part by NSF under Grant CCR-0205376 and CNS-0509230 and ONR under Grants N00014-02-1-0363 and N00014-04-1-0722.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Similar content being viewed by others

References

  1. 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)

    Chapter  Google Scholar 

  2. 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. 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. 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. 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. 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. 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)

    Chapter  Google Scholar 

  8. 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. 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. 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)

    Article  MATH  Google Scholar 

  11. 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. Flanagan, C., Freund, S.: Type inference against races. In: Giacobazzi, R. (ed.) SAS 2004. LNCS, vol. 3148, pp. 116–132. Springer, Heidelberg (2004)

    Chapter  Google Scholar 

  13. 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. 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. 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)

    Chapter  Google Scholar 

  16. 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)

    Chapter  Google Scholar 

  17. 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)

    Chapter  Google Scholar 

  18. Lipton, R.J.: Reduction: A method of proving properties of parallel programs. Communications of the ACM 18(12), 717–721 (1975)

    Article  MathSciNet  MATH  Google Scholar 

  19. 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. von Praun, C.: Detecting Synchronization Defects in Multi-Threaded Object-Oriented Programs. PhD thesis, ETH Zürich (2004)

    Google Scholar 

  21. 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)

    Chapter  Google Scholar 

  22. 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)

    Chapter  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2006 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Agarwal, R., Wang, L., Stoller, S.D. (2006). Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring. In: Ur, S., Bin, E., Wolfsthal, Y. (eds) Hardware and Software, Verification and Testing. HVC 2005. Lecture Notes in Computer Science, vol 3875. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11678779_14

Download citation

  • DOI: https://doi.org/10.1007/11678779_14

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-32604-5

  • Online ISBN: 978-3-540-32605-2

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics