| | |
Summary: Types for Safe Locking:
Static Race Detection for Java
MARTIN ABADI and CORMAC FLANAGAN
University of California at Santa Cruz
and
STEPHEN N. FREUND
Williams College
This paper presents a static racedetection analysis for multithreaded sharedmemory programs,
focusing on the Java programming language. The analysis is based on a type system that captures
many common synchronization patterns. It supports classes with internal synchronization, classes
that require clientside synchronization, and threadlocal classes. In order to demonstrate the
e#ectiveness of the type system, we have implemented it in a checker and applied it to over 40,000
lines of handannotated Java code. We found a number of race conditions in the standard Java
libraries and other test programs. The checker required fewer than 20 additional type annotations
per 1,000 lines of code. This paper also describes two improvements that facilitate checking much
larger programs: an algorithm for annotation inference and a user interface that clarifies warnings
generated by the checker. These extensions have enabled us to use the checker for identifying race
conditions in largescale software systems with up to 500,000 lines of code.
Categories and Subject Descriptors: F.3.1 [Logics and Meanings of Programs]: Specifying and
Verifying and Reasoning about Programs; D.2.4 [Software Engineering]: Software/Program
|