A Lightweight Deadlock Analysis for Programs with Threads and Reentrant Locks

  • Cosimo LaneveEmail author
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10951)


Deadlock analysis of multi-threaded programs with reentrant locks is complex because these programs may have infinitely many states. We define a simple calculus featuring recursion, threads and synchronizations that guarantee exclusive access to objects. We detect deadlocks by associating an abstract model to programs – the extended lam model – and we define an algorithm for verifying that a problematic object dependency (e.g. a circularity) between threads will not be manifested. The analysis is lightweight because the deadlock detection problem is fully reduced to the corresponding one in lams (without using other models). The technique is intended to be an effective tool for the deadlock analysis of programming languages by defining ad-hoc extraction processes.


  1. 1.
    Abadi, M., Flanagan, C., Freund, S.N.: Types for safe locking: static race detection for java. ACM Trans. Program. Lang. Syst. 28, 207–255 (2006)CrossRefGoogle Scholar
  2. 2.
    Atkey, R., Sannella, D.: Threadsafe: static analysis for java concurrency. In: Electronic Communications of the ECEASST, vol. 72 (2015)Google Scholar
  3. 3.
    Bensalem, S., Havelund, K.: Dynamic deadlock analysis of multi-threaded programs. In: Ur, S., Bin, E., Wolfsthal, Y. (eds.) HVC 2005. LNCS, vol. 3875, pp. 208–223. Springer, Heidelberg (2006). Scholar
  4. 4.
    Boyapati, C., Lee, R., Rinard, M.: Ownership types for safe program: preventing data races and deadlocks. In: OOPSLA, pp. 211–230. ACM (2002)Google Scholar
  5. 5.
    Davey, B.A., Priestley, H.A.: Introduction to Lattices and Order. Cambridge University Press, Cambridge (2002)CrossRefGoogle Scholar
  6. 6.
    Eslamimehr, M., Palsberg, J.: Sherlock: scalable deadlock detection for concurrent programs. In: Proceedings of the 22nd International Symposium on Foundations of Software Engineering (FSE-22), pp. 353–365. ACM (2014)Google Scholar
  7. 7.
    Flanagan, C., Qadeer, S.: A type and effect system for atomicity. In: PLDI, pp. 338–349. ACM (2003)Google Scholar
  8. 8.
    Flores-Montoya, A.E., Albert, E., Genaim, S.: May-happen-in-parallel based deadlock analysis for concurrent objects. In: Beyer, D., Boreale, M. (eds.) FMOODS/FORTE -2013. LNCS, vol. 7892, pp. 273–288. Springer, Heidelberg (2013). Scholar
  9. 9.
    Garcia, A., Laneve, C.: JaDA - the Java deadlock analyser. In: Behavioural Types: From Theories to Tools, pp. 169–192. River Publishers (2017)Google Scholar
  10. 10.
    Giachino, E., Kobayashi, N., Laneve, C.: Deadlock analysis of unbounded process networks. In: Baldan, P., Gorla, D. (eds.) CONCUR 2014. LNCS, vol. 8704, pp. 63–77. Springer, Heidelberg (2014). Scholar
  11. 11.
    Giachino, E., Laneve, C., Lienhardt, M.: A framework for deadlock detection in core ABS. Softw. Syst. Model. 15(4), 1013–1048 (2016)CrossRefGoogle Scholar
  12. 12.
    Jones, N.D., Landweber, L.H., Lien, Y.E.: Complexity of some problems in Petri nets. Theor. Comput. Sci. 4(3), 277–299 (1977)MathSciNetCrossRefGoogle Scholar
  13. 13.
    Kobayashi, N.: A new type system for deadlock-free processes. In: Baier, C., Hermanns, H. (eds.) CONCUR 2006. LNCS, vol. 4137, pp. 233–247. Springer, Heidelberg (2006). Scholar
  14. 14.
    Kobayashi, N., Laneve, C.: Deadlock analysis of unbounded process networks. Inf. Comput. 252, 48–70 (2017)MathSciNetCrossRefGoogle Scholar
  15. 15.
    Laneve, C., Garcia, A.: Deadlock detection of java bytecode. In: LOPSTR 2017 Pre-proceedings (2017).
  16. 16.
    Milner, R. (ed.): A Calculus of Communicating Systems. LNCS, vol. 92. Springer, Heidelberg (1980). Scholar
  17. 17.
    Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes, ii. Inf. Comput. 100, 41–77 (1992)MathSciNetCrossRefGoogle Scholar
  18. 18.
    Naik, M., Park, C.-S., Sen, K., Gay, D.: Effective static deadlock detection. In: Proceedings of the 31st International Conference on Software Engineering (ICSE 2009), pp. 386–396. ACM (2009)Google Scholar
  19. 19.
    Suenaga, K.: Type-based deadlock-freedom verification for non-block-structured lock primitives and mutable references. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 155–170. Springer, Heidelberg (2008). Scholar
  20. 20.
    Vasconcelos, V.T., Martins, F., Cogumbreiro, T.: Type inference for deadlock detection in a multithreaded polymorphic typed assembly language. In: PLACES. EPTCS, vol. 17, pp. 95–109 (2009)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Department of Computer Science and EngineeringUniversity of Bologna – Inria FocusBolognaItaly

Personalised recommendations