Implementing fast java TM monitors with relaxed-locks
David Dice · 2001
The JavaTM 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.
Cited by 21 works.
Authors
References
- Monitors
- Java Virtual Machine Specification
- The Java Programming Language
- Random number generators: good ones are hard to find
- The Sparc Architecture Manual/Version 9
- Thin locks
- The synergy between non-blocking synchronization and operating system structure
- Non-blocking synchronization and system design
- An efficient meta-lock for implementing ubiquitous synchronization
- Threads Primer: A Guide to Multithreaded Programming