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

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." 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