Deadlocks as Runtime Exceptions
نویسندگان
چکیده
Deadlocks are a common type of concurrency bug. When a deadlock occurs, it is difficult to clearly determine whether there is an actual deadlock or if the application is slow or hanging due to a different reason. It is also difficult to establish the cause of the deadlock. In general, developers deal with deadlocks by using analysis tools, introducing application-specific deadlock detection mechanisms, or simply by using techniques to avoid the occurrence of deadlocks by construction. In this paper we propose a different approach. We believe that if deadlocks manifest at runtime, as exceptions, programmers will be able to identify these deadlocks in an accurate and timely manner. We leverage two insights to make this practical: (i) most deadlocks occurring in real systems involve only two threads acquiring two locks (TTTL deadlocks); and (ii) it’s possible to detect TTTL deadlocks efficiently enough for most practical systems. We conducted a study on bug reports and found that more than 90% of identified deadlocks were indeed TTTL. We extended Java’s ReentrantLock class to detect TTTL deadlocks and measured the performance overhead of this approach with a conservative benchmark. For applications whose execution time is not dominated by locking, the overhead is estimated as below 6%. Empirical usability evaluation in two experiments showed that students finished tasks 16.87% to 30.7% faster on the average using our approach with the lock being the most significant factor behind it, and, in one of the experiments they were able to identify the defects more accurately with a signficant 81.25% increase in the number of correct answers when deadlock exceptions where present.
منابع مشابه
Instruction Scheduling in the Presence of Java's Runtime Exceptions
One of the challenges present to a Java compiler is Java’s frequent use of runtime exceptions. These exceptions affect performance directly by requiring explicit checks, as well as indirectly by restricting code movement in order to satisfy Java’s precise exception model. Instruction scheduling is one transformation which is restricted by runtime exceptions since it relies heavily on reordering...
متن کاملSearch-Based Testing of Multi-Agent Manufacturing Systems for Deadlocks Based on Models
Multi-Agent Systems (MAS) have been extensively used in the automation of manufacturing systems. However, similar to other distributed systems, autonomous agents’ interaction in the Automated Manufacturing Systems (AMS) can potentially lead to runtime behavioral failures including deadlocks. Deadlocks can cause major financial consequences by negatively affecting the production cost and time. A...
متن کاملTasking Deadlocks in Ada 95 Programs and Their Detection
Tasking deadlock is one of the most serious and complex problems concerning the reliability of concurrent systems with Ada. In this paper, tasking deadlocks which may occur in Ada 95 programs are investigated, a representation, named the Task-Wait-For Graph, for task synchronization waiting state of an Ada 95 program is proposed, and a runtime detection method for the tasking deadlocks based on...
متن کاملA Type System for Preventing Data Races and Deadlocks in Java Programs
This paper presents a new static type system for multithreaded programs; well-typed programs in our system are guaranteed to be free of data races and deadlocks. Our type system allows programmers to partition the locks into a fixed number of equivalence classes and specify a partial order among the equivalence classes. The type checker then statically verifies that whenever a thread holds more...
متن کاملA Dynamic Deadlock Prediction, Confirmation and Fixing Framework for Multithreaded Programs
Deadlocks widely exist in real-world multithreaded programs. Existing predictive strategies are not consistently scalable; existing confirmation strategies may miss to trigger deadlocks, and existing fixing strategies may incur false positives or high runtime overheads. This paper presents an overview of my approach to automatic deadlock prediction, confirmation, and fixing.
متن کامل