IP Library › Granted Patent US 9,672,077
Granted Patent B2
US 9,672,077 · App. 15/146,918 · Granted Jun 6, 2017

Reentrant read-write lock algorithm

Inventor: Marco Greco (Staines, GB)
Assignee: International Business Machines Corporation
G06F9/528G06F9/3009
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,672,077
App. No.
15/146,918
Granted
Jun 6, 2017
Kind
B2
Abstract

Access to a shareable resource between threads is controlled by a lock having shared, optimistic and exclusive modes and maintaining a list of threads requesting ownership of said lock. A shared optimistic mode is provided. A lock state descriptor is provided for each desired change of mode comprising a current mode in which a thread has already acquired the lock. When a thread acquires the lock in shared optimistic mode, other threads are allowed to acquire the lock in shared or optimistic mode. When a thread which acquired the lock in shared optimistic mode wants to acquire the lock in exclusive mode, other threads which have acquired the lock in shared or optimistic mode are prevented from acquiring the lock in exclusive mode until the thread which acquired the lock in shared optimistic mode and requested to acquire the lock in exclusive mode releases the lock.

Claims (15)

1. A computer-implemented method for managing access to a shareable resource between a plurality of concurrently executing threads, access to said shareable resource being controlled by a lock, said lock being adapted to be accessed by one or more of said plurality of concurrently executing threads in at least a shared mode, an optimistic mode and an exclusive mode and said lock maintaining a list of threads requesting ownership of said lock, the method comprising:

providing a shared optimistic mode for said lock, said lock being acquirable in said shared optimistic mode by one or more of said plurality of concurrently executing threads;

providing, for each change of mode desired by one of said concurrently executing threads, a lock state descriptor, said lock state descriptor comprising an indication of the current mode, if any, in which said one of said concurrently executing threads has already acquired said lock;

responsive to said one or more of the concurrently executing threads acquiring said lock in said shared optimistic mode, allowing others of said one or more concurrent threads to acquire said lock in said shared mode or said optimistic mode; and

responsive to said one or more of the concurrently executing threads which has acquired said lock in said shared optimistic mode requesting to acquire said lock in said exclusive mode, preventing others of said one or more of the concurrently executing threads which have acquired said lock in said shared mode or said optimistic mode from acquiring said lock in said exclusive mode until said one or more of the concurrently executing threads which has acquired said lock in said shared optimistic mode requesting to acquire said lock in said exclusive mode releases said lock.

2. The computer-implemented method of claim 1 , wherein said lock state descriptor comprises an indication of the current relationship between said lock and said one of said concurrently executing threads.

3. The computer-implemented method of claim 1 , wherein each request for a change of mode to said optimistic mode comprises an identifier identifying a portion of said shareable resource that the requestor making said request wishes to access.

4. The computer-implemented method of claim 1 , wherein each lock state descriptor further comprises a count of the number of attempts to access said lock in said shared optimistic mode, said one of the concurrently executing threads attempting to access said lock in said shared optimistic mode having its attempt to access said lock terminated when said count reaches a predetermined value.

5. The computer-implemented method of claim 1 , wherein:

responsive to said one or more of the concurrently executing threads releasing said lock from said exclusive mode;

updating a current mode or a requested mode in said lock state descriptor as being “amended” in order to indicate that a lock promoter from said optimistic mode to said exclusive mode was successful in altering said shareable resource being controlled by said lock;

updating said current mode or said requested mode in said lock state descriptor as being “preserved” in order to indicate that said lock promoter from said optimistic mode to said exclusive mode did not make a change to the structure or said requested mode; and

updating said current mode or said requested mode in said lock state descriptor as being “failed” in order to indicate that said lock promoter from said optimistic mode to said exclusive mode was unsuccessful in altering said shareable resource being controlled by said lock.

6. The computer-implemented method of claim 1 , wherein said lock state descriptor further comprises an indication as to whether, on resuming a lower lock state from a higher lock state, the lock state should be reset to that of said lower lock state so as to preserve the previous lower lock state or the lock state should be propagated from said higher lock level to said lower lock level.

7. The computer-implemented method of claim 1 , wherein higher lock levels do not acquire or release said lock if the shareable resource being managed by said lock has not been published.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded May 5, 2016
From: GRECO, MARCO
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 038464/0562 →
Continuity (2)
Continuation 14810510 · Jul 28, 2015
Related Publication 20170031731A1 · Feb 2, 2017