Patent ID: 10169107

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.