Retooling lock interfaces for using a dual mode reader writer lock
AssigneeInternational Business Machines Corporation
InventorsBruce Mealey, James Bernard Moody
Life of this patent
Estimating the term…
Abstract
A method, system, and computer usable program product for retooling lock interfaces for using a dual mode reader writer lock. An invocation of a method is received using an interface. The method is configured to operate on a lock associated with a resource in a data processing system. A determination is made whether the lock is an upgraded lock. The upgraded lock is the DML operating in an upgraded mode. An operation corresponding to the method is executed on the DML, if the lock is the upgraded lock.
Claims20
A computer implemented method for retooling lock interfaces for using a dual mode reader writer lock (DML), the computer implemented method comprising:
- receiving an invocation of a method using an interface, the method configured to operate on a lock associated with a resource in a data processing system;
- determining whether the lock is an upgraded lock, the upgraded lock being the DML operating in an upgraded mode, wherein the DML comprises an original lock and a set of expanded lock elements such that write access to the resource is acquired, held, and released using the original lock and the read access is acquired, held, and released using one of (i) the original lock and (ii) an expanded lock in the set of expanded locks, wherein a read-mode indicator in the original lock is set to a first value when the dual mode reader writer lock is used to manage read access only and the read-mode indicator in the original lock is set to a second value when the dual mode reader writer lock is used to manage a read access as well as a write access, the original lock maintaining an index of expanded lock elements in the set of expanded lock elements, modes of operation of the DML comprising a first mode of operating by using only the original lock as a reader writer lock (RWL) and a second mode of operating by using a combination of the original lock and at least one expanded lock element from the set of expanded lock elements, and wherein the first mode is indicated by setting an indicator in the original lock to a first value and the second mode is indicated by setting the indicator in the original lock to a second value;
- and
- executing, responsive to the lock being the upgraded lock, an operation on the DML corresponding to the method.
A computer usable program product comprising a non-transitory computer usable storage medium including computer usable code for retooling lock interfaces for using a dual mode reader writer lock (DML), the computer usable code comprising:
- computer usable code for receiving an invocation of a method using an interface, the method configured to operate on a lock associated with a resource in a data processing system;
- computer usable code for determining whether the lock is an upgraded lock, the upgraded lock being the DML operating in an upgraded mode, wherein the DML comprises an original lock and a set of expanded lock elements such that write access to the resource is acquired, held, and released using the original lock and the read access is acquired, held, and released using one of (i) the original lock and (ii) an expanded lock in the set of expanded locks, wherein a read-mode indicator in the original lock is set to a first value when the dual mode reader writer lock is used to manage read access only and the read-mode indicator in the original lock is set to a second value when the dual mode reader writer lock is used to manage a read access as well as a write access, the original lock maintaining an index of expanded lock elements in the set of expanded lock elements, modes of operation of the DML comprising a first mode of operating by using only the original lock as a reader writer lock (RWL) and a second mode of operating by using a combination of the original lock and at least one expanded lock element from the set of expanded lock elements, and wherein the first mode is indicated by setting an indicator in the original lock to a first value and the second mode is indicated by setting the indicator in the original lock to a second value;
- and
- computer usable code for executing, responsive to the lock being the upgraded lock, an operation on the DML corresponding to the method.
A data processing system for retooling lock interfaces for using a dual mode reader writer lock (DML), the data processing system comprising:
- a storage device including a storage medium, wherein the storage device stores computer usable program code;
- and
- a processor, wherein the processor executes the computer usable program code, and wherein the computer usable program code comprises:
- computer usable code for receiving an invocation of a method using an interface, the method configured to operate on a lock associated with a resource in the data processing system;
- computer usable code for determining whether the lock is an upgraded lock, the upgraded lock being the DML operating in an upgraded mode, wherein the DML comprises an original lock and a set of expanded lock elements such that write access to the resource is acquired, held, and released using the original lock and the read access is acquired, held, and released using one of (i) the original lock and (ii) an expanded lock in the set of expanded locks, wherein a read-mode indicator in the original lock is set to a first value when the dual mode reader writer lock is used to manage read access only and the read-mode indicator in the original lock is set to a second value when the dual mode reader writer lock is used to manage a read access as well as a write access, the original lock maintaining an index of expanded lock elements in the set of expanded lock elements, modes of operation of the DML comprising a first mode of operating by using only the original lock as a reader writer lock (RWL) and a second mode of operating by using a combination of the original lock and at least one expanded lock element from the set of expanded lock elements, and wherein the first mode is indicated by setting an indicator in the original lock to a first value and the second mode is indicated by setting the indicator in the original lock to a second value;
- and
- computer usable code for executing, responsive to the lock being the upgraded lock, an operation on the DML corresponding to the method.
Dependencies are inferred from the claim text.