Almost fair busy lock
First Claim
1. A method comprising:
- publishing a current state of a lock and a claim non-atomically to the lock by a next owning thread, in an ordered set of threads, that has requested to own the lock, the claim comprising a structure capable of being read and written only in a single memory access,obtaining, by each thread in the ordered set of threads, a ticket,wherein the claim comprises an identifier of a ticket obtained by the next owning thread, and an indication that the next owning thread is claiming the lock;
comparing the ticket obtained by the next owning thread with a current ticket;
responsive to a match between the ticket obtained by the next owning thread and the current ticket, preventing thread monitoring preemptions; and
responsive to a match between the ticket obtained by the next owning thread and the current ticket, non-atomically acquiring the lock.
1 Assignment
0 Petitions
Accused Products
Abstract
The present invention provides a method, a system, and a computer program product of preventing thread monitoring preemptions in an almost fair busy lock. In an exemplary embodiment, the method, the system, and the computer program product include (1) publishing a current state of a lock and a claim non-atomically to the lock by a next owning thread, the claim comprising a structure capable of being read and written only in a single memory access, (2) obtaining a ticket, where the claim comprises an identifier of a ticket obtained by the next owning thread, and an indication that the next owning thread is claiming the lock; (3) comparing the ticket obtained by the next owning thread with a current ticket; (4) preventing thread monitoring preemptions; and (5) responsive to a match between the ticket obtained by the next owning thread and the current ticket, non-atomically acquiring the lock.
-
Citations
17 Claims
-
1. A method comprising:
-
publishing a current state of a lock and a claim non-atomically to the lock by a next owning thread, in an ordered set of threads, that has requested to own the lock, the claim comprising a structure capable of being read and written only in a single memory access, obtaining, by each thread in the ordered set of threads, a ticket, wherein the claim comprises an identifier of a ticket obtained by the next owning thread, and an indication that the next owning thread is claiming the lock; comparing the ticket obtained by the next owning thread with a current ticket; responsive to a match between the ticket obtained by the next owning thread and the current ticket, preventing thread monitoring preemptions; and responsive to a match between the ticket obtained by the next owning thread and the current ticket, non-atomically acquiring the lock. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A system comprising:
-
a lock for controlling access to a shareable resource, the lock maintaining an ordered set of threads requesting ownership of the lock, a claim, capable of being read and written only in a single memory access, non-atomically published by a next owning thread, in the ordered set of threads, making a claim to the lock, obtaining, by each thread in the ordered set of threads, a ticket, wherein the claim comprises an identifier of a ticket obtained by the next owning thread, and an indication that the next owning thread is claiming the lock; and one or more processors, one or more computer-readable memories, one or more computer-readable tangible storage devices, and program instructions stored on at least one of the one or more computer-readable tangible storage devices for execution by at least one of the one or more processors via at least one of the one or more memories, wherein the system is capable of performing a method comprising, after publishing a current state of the lock and the claim, comparing the ticket obtained by the next owning thread with a current ticket, responsive to a match between the ticket obtained by the next owning thread and the current ticket, preventing thread monitoring preemptions, and responsive to a match between the ticket obtained by the next owning thread and the current ticket, non-atomically acquiring the lock. - View Dependent Claims (11, 12, 13)
-
-
14. A computer program product, the computer program product comprising a computer-readable storage medium having program instructions embodied therewith, the program instructions executable by a processor to cause the processor to perform a method comprising:
-
publishing a current state of a lock and a claim non-atomically to the lock by a next owing thread, in an ordered set of threads, that has requested to own the lock, the claim comprising a structure capable of being read and written only in a single memory access, wherein the claim comprises an identifier of a ticket obtained by the next owning thread, and an indication that the next owning thread is claiming the lock; comparing the ticket obtained by the next owning thread with a current ticket; responsive to a match between the ticket obtained by the next owning thread and the current ticket, preventing thread monitoring preemptions; and responsive to a match between the ticket obtained by the next owning thread and the current ticket, non-atomically acquiring the lock. - View Dependent Claims (15, 16, 17)
-
Specification