Publication
ACM SIGPLAN Notices
Paper

Lock reservation: Java locks can mostly do without atomic operations

View publication

Abstract

Because of the built-in support for multi-threaded programming, Java programs perform many lock operations. Although the overhead has been significantly reduced in the recent virtual machines, one or more atomic operations are required for acquiring and releasing an object's lock even in the fastest cases. This paper presents a novel algorithm called lock reservation. It exploits thread locality of Java locks, which claims that the locking sequence of a Java lock contains a very long repetition of a specific thread. The algorithm allows locks to be reserved for threads. When a thread attempts to acquire a lock, it can do without any atomic operation if the lock is reserved for the thread. Otherwise, it cancels the reservation and falls back to a conventional locking algorithm. We have evaluated an implementation of lock reservation in IBM's production virtual machine and compiler. The results show that it achieved performance improvements up to 53% in real Java programs.

Date

04 Nov 2002

Publication

ACM SIGPLAN Notices

Authors

Topics

Share