System and method for accessing a shared computer resource using a lock featuring different spin speeds corresponding to multiple states
First Claim
1. A method of synchronizing access to a resource in a computer system that includes a lock corresponding to said resource and a plurality of requesters that may attempt to access said resource, wherein said lock has at least three lock states, said method comprising:
- a first requester of said plurality of requesters requesting acquisition of said lock;
if said lock is in a first state, said first requester setting said lock to a second state and acquiring said lock;
if said lock is in said second state, said first requester setting said lock to a third state and spinning at a first rate; and
if said lock is in said third state, said first requester spinning at a second rate.
0 Assignments
0 Petitions
Accused Products
Abstract
A probabilistic queue lock divides requesters for a lock into at least three sets. In one embodiment, the requesters are divided into the owner of the lock, the first waiting contender, and the other waiting contenders. The first waiting contender is made probabilistically more likely to obtain the lock by having it spin faster than the other waiting contenders. Because the other waiting contenders spin more slowly, the first waiting contender is more likely to be able to observe the free lock and acquire it before the other waiting contenders notice that it is free. The first of the other waiting contenders that determines that the previous first waiting contender has acquired the lock is promoted to be the new first waiting contender and begins spinning fast. Because only the first waiting contender is spinning fast on the lock, it is probable that only the first waiting contender will attempt to acquire the lock when it becomes available.
87 Citations
20 Claims
-
1. A method of synchronizing access to a resource in a computer system that includes a lock corresponding to said resource and a plurality of requesters that may attempt to access said resource, wherein said lock has at least three lock states, said method comprising:
-
a first requester of said plurality of requesters requesting acquisition of said lock;
if said lock is in a first state, said first requester setting said lock to a second state and acquiring said lock;
if said lock is in said second state, said first requester setting said lock to a third state and spinning at a first rate; and
if said lock is in said third state, said first requester spinning at a second rate. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11)
-
-
12. A computer system comprising:
-
a resource;
a plurality of requesters coupled to said resource and configured to request access to said resource;
a lock coupled to said resource and configured to synchronize access to said resource, wherein said lock has at least a first state, a second state and a third state;
wherein, in response to a first requester of said plurality of requesters determining that said lock is in said first state, said first requester of said plurality of requesters is configured to set said lock to said second state and acquire said lock;
wherein, in response to a second requester of said plurality of requesters determining that said lock is in said second state, said second requester of said plurality of requesters is configured to set said lock to said third state and to spin at a first rate; and
wherein, in response to a third requester of said plurality of requesters determining that said lock is in said third state, said third requester of said plurality of requesters is configured to spin at a second rate. - View Dependent Claims (13, 14, 15, 16, 17, 18, 19, 20)
-
Specification