Increasing functionality of a reader-writer lock
First Claim
Patent Images
1. A method comprising:
- accessing a shared memory associated with a reader-writer lock according to a first concurrency mode;
maintaining a count of a number of accesses according to the first concurrency mode that abort, wherein the count is associated with a group of reader-writer locks including the reader-writer lock, the group corresponding to reader-writer locks accessed by a first thread of a plurality of threads;
dynamically changing from the first concurrency mode to a second concurrency mode based on a comparison between the count and a threshold, wherein the first concurrency mode comprises an optimistic concurrency mode in which the shared memo is accessed before the reader-writer lock is analyzed and the second concurrency mode comprises a pessimistic concurrency mode in which a write access to the shared memory is not permitted until the reader-writer lock is analyzed; and
accessing the shared memory according to the second concurrency mode.
1 Assignment
0 Petitions
Accused Products
Abstract
In one embodiment, the present invention includes a method for accessing a shared memory associated with a reader-writer lock according to a first concurrency mode, dynamically changing from the first concurrency mode to a second concurrency mode, and accessing the shared memory according to the second concurrency mode. In this way, concurrency modes can be adaptively changed based on system conditions. Other embodiments are described and claimed.
46 Citations
18 Claims
-
1. A method comprising:
-
accessing a shared memory associated with a reader-writer lock according to a first concurrency mode; maintaining a count of a number of accesses according to the first concurrency mode that abort, wherein the count is associated with a group of reader-writer locks including the reader-writer lock, the group corresponding to reader-writer locks accessed by a first thread of a plurality of threads; dynamically changing from the first concurrency mode to a second concurrency mode based on a comparison between the count and a threshold, wherein the first concurrency mode comprises an optimistic concurrency mode in which the shared memo is accessed before the reader-writer lock is analyzed and the second concurrency mode comprises a pessimistic concurrency mode in which a write access to the shared memory is not permitted until the reader-writer lock is analyzed; and accessing the shared memory according to the second concurrency mode. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. An article comprising a machine-accessible medium including instructions that when executed cause a system to:
-
access data associated with a lock variable without acquiring the lock variable; perform a transaction using the data; commit the transaction if a value of the lock variable has not changed from the time of access to the time of commitment; and otherwise, abort the transaction and increment a count of aborted transactions, wherein the count is associated with a group of lock variables including the lock variable, the group corresponding to lock variables accessed by a first thread of a plurality of threads executing on the system. - View Dependent Claims (11, 12, 13, 14)
-
-
15. A system comprising:
-
a processor to execute a first thread and a second thread; and a transactional memory coupled to the processor, the transactional memory including a lock variable for a shared memory location, the lock variable to operate in a first concurrency mode or a second concurrency mode based upon a value of a mode indicator of the lock variable, wherein the lock variable further includes an upgrade indicator to indicate whether a reader seeks an upgrade to a writer status, wherein the reader is to atomically set the upgrade indicator only if the upgrade indicator is not currently set, a notification indicator to indicate whether the reader seeks notification after a writer has acquired and released the lock variable, and a reader indicator having a first state to indicate that a writer has acquired the lock variable and otherwise having a second state, and wherein the first thread is to abort a transaction if a value of the lock variable has changed from a time of access of the shared memo location b the first thread to a time of commitment of the transaction, and the system is to update a count of aborted transactions if the value of lock variable changed, the count associated with a group of lock variables including the lock variable accessed by the first thread and to dynamically switch from the first concurrency mode to the second concurrency mode based in part on the count. - View Dependent Claims (16, 17, 18)
-
Specification