Abstract

Multithreading support and exception handling are two language features of Java. However, Java exception handling is not utilized to support multithreaded programming. I first report the design, implementation and application of two newly defined Runtime exceptions to detect deadlock, a type of application-level fault that is hard to find and remove in multithreaded Java programs. One of these two exceptions is thrown when two or more threads are otherwise to be involved in a cyclic wait for resources, and the other is raised when all the threads in the system are otherwise about to be blocked forever. The efficient implementation, using the modified Latte JVM, can be used as a platform not only for runtime debugging but also for deadlock-tolerant programming.

I then propose sound and efficient static analyses to aid programmers using the newly defined Runtime exceptions. Unlike traditional static analyses whose goal is to report "may deadlock" statements, my static analyses mark some statements whose execution surely gets at least one thread to wait indefinitely, whether or not one of the newly defined exceptions is thrown. In addition, the new analyses also identify as many as possible "cannot deadlock" statements, thus alleviating the programmers from the burden of considering those statements, when considering deadlock exceptions. Furthermore, the static analyses I propose can also be used to reduce the implementation overhead of the two Runtime exceptions designed for deadlock.