Dynamic Livelock Analysis of Multi-threaded Programs

  • Malay K. Ganai
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 7687)

Abstract

Compared to deadlocks, where one or more threads are blocked forever, livelocks are harder to detect as it is not easy to distinguish between a long and an infinite busy wait (i.e., no progress) cycle. We propose a dynamic livelock analysis for a multi-threaded program by examining its execution trace. From the observed trace events, our approach uncovers livelock potentials due to infinite executions where one or more threads in a group are acquiring and releasing resources in busy-wait cycles to avoid deadlocks. Furthermore, to confirm a livelock potential, we orchestrate a partial-order schedule to induce a livelock during a program re-execution. We implemented our proposed approach in a prototype tool CBuster, comprising a light-weight binary instrumentation framework for C/C++ programs to record events, and to replay partial-order schedules. We applied our approach to identify and confirm livelocks in a case study based on SQLite, a widely used embedded multi-threaded database engine.

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 1.
    Ho, A., Smith, S., Hand, S.: On deadlock, livelock, and forward progress. Technical Report UCAM-CL-Tr-633, University of Cambridge, Computer Laboratory (2005)Google Scholar
  2. 2.
    Stallings, W.: Operating Systems: Internals and Design Principles. Prentice Hall (2001)Google Scholar
  3. 3.
    Mogul, J.C., Ramakrishnan, K.K.: Eliminating receive livelock in an interrupt-driven kemel. ACM Trans. Comput. Syst. 15(3), 217–252 (1997)CrossRefGoogle Scholar
  4. 4.
    Tai, K.-C.: Definitions and detection of deadlock, livelock, and starvation in concurrent programs. In: ICPP, pp. 69–72 (1994)Google Scholar
  5. 5.
    Owicki, S.S., Lamport, L.: Proving liveness properties of concurrent programs. ACM Trans. Program. Lang. Syst. 4(3), 455–495 (1982)MATHCrossRefGoogle Scholar
  6. 6.
  7. 7.
  8. 8.
  9. 9.
    Blieberger, J., Burgstaller, B., Mittermayr, R.: Static Detection of Livelocks in Ada Multitasking Programs. In: Abdennadher, N., Kordon, F. (eds.) Ada-Europe 2007. LNCS, vol. 4498, pp. 69–83. Springer, Heidelberg (2007)CrossRefGoogle Scholar
  10. 10.
    Ouaknine, J., Palikareva, H., Roscoe, A.W., Worrell, J.: Static Livelock Analysis in CSP. In: Katoen, J.-P., König, B. (eds.) CONCUR 2011. LNCS, vol. 6901, pp. 389–403. Springer, Heidelberg (2011)CrossRefGoogle Scholar
  11. 11.
    Holzmann, G.: The model checker spin. IEEE Transactions on Software Engineering (1997)Google Scholar
  12. 12.
    Visser, W., Havelund, K., Brat, G., Park, S.: Model checking programs. In: Proc. of ASE (2000)Google Scholar
  13. 13.
    Li, T., Lebeck, A.R., Sorin, D.J.: Spin detection hardware for improved management of multithreaded systems. IEEE Transactions on Parallel and Distrubuted Systems 17, 508–521 (2006)CrossRefGoogle Scholar
  14. 14.
    Engler, D.R., Ashcraft, K.: RacerX: effective, static detection of race conditions and deadlocks. In: SOSP, pp. 237–252 (2003)Google Scholar
  15. 15.
    Williams, A., Thies, W., Ernst, M.D.: Static Deadlock Detection for Java Libraries. In: Gao, X.-X. (ed.) ECOOP 2005. LNCS, vol. 3586, pp. 602–629. Springer, Heidelberg (2005)CrossRefGoogle Scholar
  16. 16.
    Shanbhag, V.K.: Deadlock-detection in Java-library using static-analysis. In: APSEC, pp. 361–368 (2008)Google Scholar
  17. 17.
    Naik, M., Park, C.-S., Sen, K., Gay, D.: Effective static deadlock detection. In: Proc. of ICSE, pp. 386–396 (2009)Google Scholar
  18. 18.
    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
  19. 19.
    Wang, Y., Kelly, T., Kudlur, M., Lafortune, S., Mahlke, S.A.: Gadara: Dynamic deadlock avoidance for multithreaded programs. In: OSDI, pp. 281–294 (2008)Google Scholar
  20. 20.
    Jula, H., Tralamazza, D.M., Zamfir, C., Candea, G.: Deadlock immunity: Enabling systems to defend against deadlocks. In: OSDI (2008)Google Scholar
  21. 21.
    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)CrossRefGoogle Scholar
  22. 22.
    Agarwal, R., Wang, L., Stoller, S.D.: Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring. In: Ur, S., Bin, E., Wolfsthal, Y. (eds.) HVC 2005. LNCS, vol. 3875, pp. 191–207. Springer, Heidelberg (2006)CrossRefGoogle Scholar
  23. 23.
    Bensalem, S., Fernandez, J.-C., Havelund, K., Mounier, L.: Confirmation of deadlock potentials detected by runtime analysis. In: PADTAD, pp. 41–50 (2006)Google Scholar
  24. 24.
    Agarwal, R., Stoller, S.D.: Run-time detection of potential deadlocks for programs with locks, semaphores, and condition variables. In: PADTAD, pp. 51–60 (2006)Google Scholar
  25. 25.
    Joshi, P., Park, C.-S., Sen, K., Naik, M.: A randomized dynamic program analysis technique for detecting real deadlocks. In: Proc. of PLDI, pp. 110–120 (2009)Google Scholar
  26. 26.
    Joshi, P., Naik, M., Sen, K., Gay, D.: An effective dynamic analysis for detecting generalized deadlocks. In: FSE (2010)Google Scholar
  27. 27.
    Luo, Z.D., Das, R., Qi, Y.: Multicore SDK: A practical and efficient deadlock detector for real-world applications. In: ICST, pp. 309–318 (2011)Google Scholar
  28. 28.
    Cai, Y., Chan, W.K.: Magicfuzzer: Scalable deadlock detection for large-scale applications. In: Proc. of ICSE (2012)Google Scholar
  29. 29.
    Qin, F., Tucek, J., Sundaresan, J., Zhou, Y.: Rx: treating bugs as allergies - a safe method to survive software failures. In: SOSP, pp. 235–248 (2005)Google Scholar
  30. 30.
    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
  31. 31.
    SQLite home page, http://www.sqlite.org/
  32. 32.
    Mattern, F.: Virtual time and global states of distributed systems. In: Workshop on Parallel and Distributed Algorithms, France (1988)Google Scholar
  33. 33.
    Fidge, J.: Timestamps in message-passing systems that preserve the partial ordering. In: Australian Computer Science Conference (1988)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2013

Authors and Affiliations

  • Malay K. Ganai
    • 1
  1. 1.NEC Labs AmericaPrincetonUSA

Personalised recommendations