Browse Prior Art Database

Fast Recursive Locking in Java

IP.com Disclosure Number: IPCOM000013016D
Original Publication Date: 2000-May-01
Included in the Prior Art Database: 2003-Jun-12
Document File: 2 page(s) / 27K

Publishing Venue

IBM

Abstract

Disclosed is a method to reduce overhead of recursive locking in Java language execution. If a lock operation is performed to an already-locked object, the method does not actually perform the recursive lock operation but only records that the lock is "omitted."

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 69% of the total text.

Page 1 of 2

Fast Recursive Locking in Java

Disclosed is a method to reduce overhead of recursive locking in Java
language execution. If a lock operation is performed to an already-locked
object, the method does not actually perform the recursive lock operation but
only records that the lock is "omitted."

At unlocking time, the method performs unlocking operation only when
the corresponding lock was not omitted.

In Java program, many locks (monitorenter) and unlocks (monitorexit)
are performed during its execution. It is possible to lock an object
recursively, and usually recursive lock is controlled by a counter
associated to the object. In addition, the history of lock operations
is "logged" in some manner to unlock some of them when exception
occurs. Therefore, usually recursive locking contains the following
operation:

LOCK ObjectA Actually lock the object and create a lock-log 1
LOCK ObjectA Increment the recursion-counter and create a lock-log 2
LOCK ObjectA Increment the recursion-counter and create a lock-log 3
UNLOCK ObjectA Decrement the recursion-counter and remove the lock-log 3
UNLOCK ObjectA Decrement the recursion-counter and remove the lock-log 2
UNLOCK ObjectA Actually unlock the object and remove the lock-log 1

The disclosed method "omits" the counter increment and lock-log
creation for recursive locking, and records the omission. At
unlocking time, the method first checks if the corresponding lock
operation was omitted and does nothing if it was omitted. The
disclosed method...