SYNCHRONIZATION MECHANISMS BASED ON COUNTERS
First Claim
1. A computer implemented method, comprising:
- maintaining a plurality of counters in memory including a lock counter and an unlock counter to synchronize a plurality of requests, the lock counter indicating a cumulative number of the requests, and the unlock counter indicating a cumulative number of a portion of the requests having released the lock;
selecting at least one of the requests to grant a lock according to the counters; and
performing the synchronized operations for the selected requests.
2 Assignments
0 Petitions
Accused Products
Abstract
A method and apparatus to maintain a plurality of counters to synchronize a plurality of requests for a lock independent of interlocks are described. The plurality of counters include a lock counter and an unlock counter. The requests wait in a wait queue maintained separately from the counters without direct access between the counters and the wait queue. The lock counter indicates a cumulative number of lock requests to acquire the lock. The unlock counter indicates a cumulative number of unlock requests to release the lock acquired. One or more requests waiting for the lock are selected according to the counters to be granted with the lock when the lock is released. A request corresponds to a task performing synchronized operations when granted with the lock.
-
Citations
70 Claims
-
1. A computer implemented method, comprising:
-
maintaining a plurality of counters in memory including a lock counter and an unlock counter to synchronize a plurality of requests, the lock counter indicating a cumulative number of the requests, and the unlock counter indicating a cumulative number of a portion of the requests having released the lock; selecting at least one of the requests to grant a lock according to the counters; and performing the synchronized operations for the selected requests. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13)
-
-
14. A machine-readable storage medium having instructions, when executed by a machine, cause the machine to perform a method, the method comprising:
-
maintaining a plurality of counters in memory including a lock counter and an unlock counter to synchronize a plurality of requests, the lock counter indicating a cumulative number of the requests, and the unlock counter indicating a cumulative number of a portion of the requests having released the lock; selecting at least one of the requests to grant a lock according to the counters; and performing the synchronized operations for the selected requests.
-
-
15. An apparatus, comprising:
-
a synchronization library configured in a user mode to maintain a plurality of counters in memory including a lock counter and an unlock counter to synchronize a plurality of requests, the lock counter indicating a cumulative number of the requests, and the unlock counter indicating a cumulative number of a portion of the requests having released the lock; a kernel library configured in a kernel mode to select at least one of the requests to grant a lock according to the counters; and an interface module configured to performing the synchronized operations for the selected requests.
-
-
16. A computer implemented method, comprising:
-
maintaining one or more counters to synchronize a plurality of requests for a lock, the counters having a state indicating values of the counters; calling a first kernel interface with a first state to wait for the lock; updating the counters atomically based on a second state of the counters returned from the first kernel interface; and performing synchronized operations subsequent to the update of the counters. - View Dependent Claims (17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34)
-
-
35. A machine-readable storage medium having instructions, when executed by a machine, cause the machine to perform a method, the method comprising:
-
maintaining one or more counters in memory to synchronize a plurality of requests for a lock, the counters having a state indicating values of the counters; calling a first kernel interface with a first state to wait for the lock; updating the counters atomically based on a second state of the counters returned from the first kernel interface; and performing synchronized operations subsequent to the update of the counters.
-
-
36. An apparatus, comprising:
-
a user library configured to maintain one or more counters in memory to synchronize a plurality of requests for a lock, the counters having a state indicating values of the counters, comprising; a lock handler module configured to count the lock counter for calling a first kernel interface with a first state to wait for the lock, and an unlock handler module configured to update the counters atomically based on a second state of the counters returned from the first kernel interface; and an interface module configured to perform synchronized operations subsequent to the update of the counters.
-
-
37. A computer implemented method, comprising:
-
maintaining one or more counters in memory to synchronize a plurality of lock requests, each lock request being associated with a lock count indicating a cumulative number of the lock requests initiated for a lock when the lock request is received in a wait queue; in response to receiving an unlock request to release the lock, comparing a state of the counters with the unlock request to determine whether to expect additional lock requests; selecting one or more of the lock requests from the wait queue to grant the lock if no additional lock requests is expected; and performing synchronized operations for the selected lock requests. - View Dependent Claims (38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 57, 58, 59, 60)
-
-
53. The method of 52, further comprising:
updating the counters according to the unlock request and the number of the additional lock requests expected. - View Dependent Claims (54, 55, 56)
-
61. A machine-readable storage medium having instructions, when executed by a machine, cause the machine to perform a method, the method comprising:
-
maintaining one or more counters in memory to synchronize a plurality of lock requests, each lock request being associated with a lock count indicating a cumulative number of the lock requests initiated for a lock when the lock request is received in a wait queue; in response to receiving an unlock request to release the lock, comparing a state of the counters with the unlock request to determine whether to expect additional lock requests; selecting one or more of the lock requests from the wait queue to grant the lock if no additional lock requests is expected; and performing synchronized operations for the selected lock requests.
-
-
62. An apparatus, comprising:
-
a wait queue to store one or more lock requests, each lock request being associated with a lock count indicating a cumulative number of the lock requests initiated for a lock; a kernel library configured to maintain one or more counters in memory to synchronize the lock requests, in response to receiving an unlock request to release the lock, compare a state of the counters with the unlock request to determine whether to expect additional lock requests, and select one or more of the lock requests from the wait queue to grant the lock if no additional lock requests is expected; and an interface module configured to perform synchronized operations subsequent to the update of the counters.
-
-
63. A computer implemented method, comprising:
-
counting up a lock counter in memory atomically to wait for a lock to synchronize operations among a plurality of tasks; when the lock is granted, performing the synchronized operations for at least one of the plurality of tasks; and counting up an unlock counter in the memory atomically subsequent to the synchronized operations. - View Dependent Claims (64, 65, 66, 67, 68, 69, 70)
-
Specification