| | |
Summary: Types for Safe Locking
Cormac Flanagan and Mart’n Abadi
[flanagan|ma]@pa.dec.com
Systems Research Center, Compaq
Abstract. A race condition is a situation where two threads manipu
late a data structure simultaneously, without synchronization. Race con
ditions are common errors in multithreaded programming. They often
lead to unintended nondeterminism and wrong results. Moreover, they
are notoriously hard to diagnose, and attempts to eliminate them can
introduce deadlocks. In practice, race conditions and deadlocks are of
ten avoided through prudent programming discipline: protecting each
shared data structure with a lock and imposing a partial order on lock
acquisitions. In this paper we show that this discipline can be captured
(if not completely, to a significant extent) through a set of static rules.
We present these rules as a type system for a concurrent, imperative
language. Although weaker than a fullblown programverification cal
culus, the type system is e#ective and easy to apply. We emphasize a
core, firstorder type system focused on race conditions; we also consider
extensions with polymorphism, existential types, and a partial order on
lock types.
|