Low-contention lock
First Claim
Patent Images
1. A method of managing a lock utilized by a plurality of threads executing on a computing device to coordinate access to a shared resource, the method comprising:
- selecting by one of the threads, an action to be performed by the thread upon the lock, wherein the action is selected from a group comprising;
acquiring the lock,trying to acquire the lock, andreleasing the lock;
asynchronously querying and receiving a first state of the lock as a current state of the lock by the thread, the lock being considered to be in any one of at least four states in any point in time, the states defined by a state machine associated with the lock;
speculatively determining by the thread, a second state of the lock based at least in part on the first state and the selected action; and
attempting to perform by the thread, the selected action to transition the lock from the first state to the speculatively determined second state, the attempting including determining if the first state remains the current state of the lock, and, if the first state remains the current state, performing the selected action to transition the current state of the lock to the second state.
1 Assignment
0 Petitions
Accused Products
Abstract
The present disclosure relates to acquiring and releasing a shared resource via a lock semaphore and, more particularly, to acquiring and releasing a shared resource via a lock semaphore utilizing a state machine.
19 Citations
44 Claims
-
1. A method of managing a lock utilized by a plurality of threads executing on a computing device to coordinate access to a shared resource, the method comprising:
-
selecting by one of the threads, an action to be performed by the thread upon the lock, wherein the action is selected from a group comprising; acquiring the lock, trying to acquire the lock, and releasing the lock; asynchronously querying and receiving a first state of the lock as a current state of the lock by the thread, the lock being considered to be in any one of at least four states in any point in time, the states defined by a state machine associated with the lock; speculatively determining by the thread, a second state of the lock based at least in part on the first state and the selected action; and attempting to perform by the thread, the selected action to transition the lock from the first state to the speculatively determined second state, the attempting including determining if the first state remains the current state of the lock, and, if the first state remains the current state, performing the selected action to transition the current state of the lock to the second state. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
-
-
17. An apparatus comprising:
-
a processor; a storage medium coupled to the processor, and having stored therein programming instructions to be operated by the processor to implement a lock acquirer to acquire a lock, having a multi-part state value defined by a state machine associated with the lock;
wherein the lock acquirer performs an acquisition of the lock viaasynchronously querying and receiving a first state of the lock as a current state of the lock, by the lock acquirer, the lock being considered to be in any one of at least four states in any point in time, and each state is represented by the multi-part state value; speculatively determining by the lock acquirer, a second state of the lock based at least in part on the first state of the lock; and attempting to perform, by the lock acquirer, the acquisition of the lock to transition the lock from the first state to the speculatively determined second state, the attempting including determining if the first state remains the current state of the lock, and, if the first state remains the current state, performing the acquisition to transition the current state of the lock to the second state. - View Dependent Claims (18, 19, 20, 21, 22, 23)
-
-
24. An apparatus comprising:
-
a processor; a storage medium coupled to the processor, and having stored therein programming instructions to be operated by the processor to implement a lock releaser to release a lock, the lock having a multi-part state value defined by a state machine associated with the lock; wherein the lock releaser, release said hold on the lock via asynchronously querying and receiving a first state of the lock as a current state of the lock, by the lock releaser, the lock being considered to be in any one of at least four states in any point in time, and each state is represented by the multi-part state value; speculatively determining by the lock releaser, a second state of the lock based at least in part on the first state of the lock; and attempting to perform, by the lock releaser, the releasing of the lock to transition the lock from the first state to the speculatively determined second state, the attempting including determining if the first state remains the current state of the lock, and, if the first state remains the current state, performing the releasing to transition the current state of the lock to the second state. - View Dependent Claims (25, 26, 27, 28, 29)
-
-
30. An article comprising:
-
a storage medium; and a plurality of programming instructions stored on the storage medium and configured, when executed by a processor to coordinate access to a shared resource for a plurality of threads, by performing a method of; selecting by one of the threads an action to be performed a thread upon a lock utilized by the thread, wherein the action is selected from a group comprising; acquiring the lock, trying to acquire the lock, and releasing the lock; asynchronously querying and receiving a first state of the lock as a current state of the lock, by the thread, the lock being considered to be in any one of at least four states in any point in time, and each state is represented by a multi-part state value defined by a state machine associated with the lock; speculatively determining by the thread, a second state of the lock based at least in part on the first state of the lock and the selected action; and attempting to perform by the thread, the selected action to transition the lock from the first state to the speculatively determined second state, the attempting including determining if the first state remains the current state of the lock, and, if the first state remains the current state, performing the selected action to transition the current state of the lock to the second state. - View Dependent Claims (31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44)
-
Specification