JVM 2001 Abstract
Implementing
Fast Java Monitors with Relaxed-Locks
David Dice, Sun Microsystems, Inc.
Abstract
The Java
Programming Language permits synchronization operations (lock, unlock, wait,
notify) on any object. Synchronization is very common in applications and is
endemic in the library code upon which applications depend. It is therefore
critical that a monitor implementation be both space-efficient and time-efficient.
We present a locking protocol, the Relaxed-Lock, that satisfies those
requirements. The Relaxed-Lock is reasonably compact, using only one machine
word in the object header. It is fast, requiring in the uncontested case only
one atomic compare-and-swap to lock a monitor and no atomic instructions to
release a monitor. The Relaxed-Lock protocol is unique in that it admits a benign
data race in the monitor unlock path (hence its name) but detects and recovers
from the race and thus maintains correct mutual exclusion. We also introduce
speculative deflation, a mechanism for releasing a monitor when it is no longer
needed.
- View the full text of this paper in
HTML form, and
PDF form.
- If you need the latest Adobe Acrobat Reader, you can download it from Adobe's site.
- To become a USENIX Member, please see our Membership Information.
|