Skip to main content

Multi-Thread Run-time Analysis Tool for Java

A tool that detects and analyzes potential data race and deadlock conditions that might occur in multi-threaded Java programs.

Date Posted: March 11, 2008

alphaworks tab navigation


 

Update: March 3, 2009
New version is more stable due to bug fixes, and supports Linux/X86_64 and AIX/PPC64 platforms.

 

What is Multi-Thread Run-time Analysis Tool for Java?

Multi-threaded programming is both difficult and error-prone: It is easy to introduce memory and synchronization errors that produce data race and deadlock conditions. When these errors occur, they are typically hard to locate. The most common memory and synchronization errors are data race and deadlock. Data race occurs when two threads access the same memory location with no ordering constraints enforced between the accesses, where at least one of these accesses is a "write." A deadlock is a situation in which two or more competing actions are waiting for the other to finish, so that neither ever does. Both situations are destructive and are common when building multi-threaded programs.

Multi-Thread Run-time Analysis Tool for Java™ is an accurate and efficient run-time analysis tool for finding data races and deadlock conditions in multi-threaded code. This tool instruments applications to collect run-time information for detection of data race or deadlock conditions. Code is instrumented dynamically at run time by using byte code rewriting techniques. Execution of the instrumented code generates events that are analyzed "on the fly" using sophisticated data race and deadlock detection algorithms. The output from the detection algorithms is both precise and accurate. In experiments with both small and large example applications, it has been found that the tool puts out few spurious race and deadlock conditions.

The tool is easy to use and provides both a command line interface and a GUI front-end in Eclipse. The package includes binaries for instrument one's applications; documentation; and example logs and results.

How does it work?

In order to access the run-time information of multi-threaded program without Java code modifications, byte code rewriting techniques are used. The tool, with the help of the ASM byte code rewriting toolkit, instruments certain points of interest in the user's program during class loading by the Java virtual machine. When the program is executed, a stream of events is generated from the various instrumentation points; this information is propagated to the analysis engine (running in another process) through sockets.

In the analysis engine, sophisticated algorithms are used for data race detection and deadlock detection for multi-threaded programs. The data race detection algorithm is a hybrid version of the two well-known race detection algorithms called lockset and happens-before. This hybrid approach makes the tool more efficient and precise (see "Hybrid Dynamic Data Race Detection"). The "weaker-than" relation (see "Efficient and Precise Datarace Detection for Multi-threaded Object-Oriented Programs") and the "Eraser" state machine (see "Eraser: A Dynamic Data Race Detector for Multi-threaded Programs") are used to filter program events in order to improve the performance of this tool.

The deadlock detection algorithm is based on lock graphs. When the user's program is running, the information of lock and synchronization is recorded and a lock graph is created. When the program exits, the deadlock detector checks for cycles in the lock graph. After all non-deadlocked cycles (false positives) are removed, the rest are reported to the user as potential deadlocks.

About the technology author(s)

Raja Das is a software architect in IBM's Software Group. Currently, he is developing libraries and frameworks for multicore/manycore systems. Previously, he was the WebSphere® Partner Gateway product architect. Mr. Das's interests include programming languages, parallel software, and systems.

Zhi Gan

Zhi Gan, a software engineer at IBM's China Development Lab, joined IBM after receiving a Ph.D. in computer security from Shanghai JiaoTong University. Mr. Gan has extensive experience in SOA (service-oriented architecture), AOP (aspect-oriented programming), and Eclipse. His current focus is mainly on model-driven development with patterns.


Yao Qi

Yao Qi is a software engineer at IBM's China Emerging Technology Institute, China Development Lab. He joined IBM in 2006. Mr. Qi has experience in compiler, debugger, and open-source development and is currently working on a run-time analysis tool. Mr. Qi holds a master's degree in computer science from Beijing Institute of Technology, Beijing, China.


Zhi Da Luo

Zhi Da Luo is a software engineer at IBM Emerging Technology Institute, China Development Lab. Mr. Luo joined IBM in 2008. He has experience in embedded software development and is currently working on a run-time analysis tool. Mr. Luo holds a master degree in software engineering from Peking University in Beijing, China.

Trademarks




Related technologies