A study of locking objects with bimodal fields

Object locking can be efficiently implemented by bimodal use of a field reserved in an object. The field is used as a lightweight lock in one mode, while it holds a reference to a heavyweight lock in the other mode. A bimodal locking algorithm recently proposed for Java achieves the highest performance in the absence of contention, and is still fast enough when contention occurs. However, mode transitions inherent in bimodal locking have not yet been fully considered. The algorithm requires busy-wait in the transition from the light mode (inflation), and does not make the reverse transition (deflation) at all. We propose a new algorithm that allows both inflation without busy-wait and deflation, but still maintains an almost maximum level of performance in the absence of contention. We also present statistics on the synchronization behavior of real multithreaded Java programs, which indicate that busy-wait in inflation and absence of deflation can be problematic in terms of robustness and performance. Actually, an implementation of our algorithm shows increased robustness, and achieves performance improvements of up to 13.1% in server-oriented benchmarks.

[1]  Sarita V. Adve,et al.  Shared Memory Consistency Models: A Tutorial , 1996, Computer.

[2]  Butler W. Lampson,et al.  Experience with processes and monitors in Mesa , 1980, CACM.

[3]  John K. Ousterhout Scheduling Techniques for Concurrebt Systems. , 1982, ICDCS 1982.

[4]  Andreas Krall,et al.  Monitors and exceptions: how to implement Java efficiently , 1998 .

[5]  Michael L. Scott,et al.  Algorithms for scalable synchronization on shared-memory multiprocessors , 1991, TOCS.

[6]  Y. S. Ramakrishna,et al.  An efficient meta-lock for implementing ubiquitous synchronization , 1999, OOPSLA '99.

[7]  John K. Ousterhout,et al.  Scheduling Techniques for Concurrent Systems , 1982, ICDCS.

[8]  Andreas Krall,et al.  Monitors and Exceptions: How to Implement Java Efficiently , 1998, Concurr. Pract. Exp..

[9]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[10]  Yuichi Nakamura,et al.  Architecture and performance evaluation of a massive multi-agent system , 1999, AGENTS '99.

[11]  Cathy May,et al.  The PowerPC Architecture: A Specification for a New Family of RISC Processors , 1994 .

[12]  Anant Agarwal,et al.  Waiting algorithms for synchronization in large-scale multiprocessors , 1993, TOCS.

[13]  Anna R. Karlin,et al.  Empirical studies of competitve spinning for a shared-memory multiprocessor , 1991, SOSP '91.

[14]  Thomas E. Anderson,et al.  The Performance of Spin Lock Alternatives for Shared-Memory Multiprocessors , 1990, IEEE Trans. Parallel Distributed Syst..

[15]  Ole Agesen Space and Time-Efficient Hashing of Garbage-Collected Objects , 1999, Theory Pract. Object Syst..