Patent ID: 8166256

Claim:
A computer implemented method for using a dual mode reader writer lock (DML), the computer implemented method comprising: detecting a contention condition in the use of a lock in a data processing system, the lock being used for managing read and write access to a resource in the data processing system; determining a data structure used for implementing the lock; responsive to the data structure being a data structure of a reader writer lock (RWL), transitioning the data structure to a second data structure suitable for implementing the DML; determining whether the DML has been expanded; responsive to the DML not having been expanded, expanding the DML such that the data structure includes an original lock and a set of expanded locks, the original lock and each expanded lock in the set of expanded locks forming an element of the DML; receiving a request from a process in the data processing system to perform an operation using the DML; determining whether to switch a mode of operation of the DML from a first mode to a second mode, the first mode of operation of the DML using the original lock of the DML, and the second mode of operation of the DML using the original lock and a subset of the expanded locks; switching the mode of operation of the DML to the second mode responsive to a determination to switch to the second mode; and assigning the process to one of the elements of the DML, the one of the elements forming an assigned element.