Detecting Potential Deadlocks with Static Analysis and Run-Time Monitoring
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.
Unable to display preview. Download preview PDF.
- [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
- [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
- [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/
- [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
- [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
- [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
- [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
- [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
- [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
- [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
- [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
- [vP04]von Praun, C.: Detecting Synchronization Defects in Multi-Threaded Object-Oriented Programs. PhD thesis, ETH Zürich (2004) Google Scholar