Volume 35, Issue 3 pp. 281-299
Research Article

Lightweight monitors for the Java virtual machine

Byung-Sun Yang

Byung-Sun Yang

School of Electrical Engineering, Seoul National University, Kwanak, P.O. Box 34, Seoul 151-742, Korea

Search for more papers by this author
Soo-Mook Moon

Corresponding Author

Soo-Mook Moon

School of Electrical Engineering, Seoul National University, Kwanak, P.O. Box 34, Seoul 151-742, Korea

School of Electrical Engineering, Seoul National University, Kwanak, P.O. Box 34, Seoul 151-742, KoreaSearch for more papers by this author
Kemal Ebcioğlu

Kemal Ebcioğlu

IBM T. J. Watson Research Center, P.O. Box 704, Yorktown Heights, NY 10598, U.S.A.

Search for more papers by this author
First published: 03 December 2004
Citations: 2

This is a revised and expanded version of a paper published in the Third Workshop on Interaction Between Compilers and Computer Architectures, October 1998

Abstract

Java supports the monitor construct for language-level synchronization in the context of multi-threading. This paper introduces the lightweight monitor, an efficient user-level monitor implementation. The lightweight monitor is useful for single-threaded Java programs as well as for multi-threaded Java programs with little lock contention. A 32-bit lock is embedded in each object for efficient lock access while other monitor data structures are managed using a hash table. We highly optimized the lock manipulation code, which is translated and inlined by a just-in-time (JIT) compiler. In the most probable cases, only nine SPARC instructions are spent for lock acquisition and five instructions are spent for lock release. Our experimental results indicate that the lightweight monitor is faster than the monitor implementation in the SUN JDK 1.2 RC1 by up to 21 times in the absence of lock contention and by up to seven times in the presence of lock contention. Copyright © 2004 John Wiley & Sons, Ltd.

The full text of this article hosted at iucr.org is unavailable due to technical difficulties.