Transactional Locking with Read-Write Locks in Transactional Memory Systems
First Claim
1. A computer-implemented method, comprising:
- associating each of a plurality of shared memory areas with a respective read-write lock, wherein for each shared memory area the read-write lock includes a read-lock portion indicating whether any thread has a read-lock for read-only access to the associated shared memory area and a write-lock portion indicating whether any thread has a write-lock for write access to the associated shared memory area;
a thread executing a set of program instructions including a plurality of memory access operations to shared memory to be completed as an atomic transaction, wherein for each memory access operation of the atomic transaction said executing comprises;
if the memory access is a read access;
attempting to obtain the read-lock portion of the read-write lock for the corresponding shared memory area, wherein the read-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and
performing the read access only after successfully obtaining the read-lock portion of the read-write lock; and
if the memory access is a write access;
attempting to obtain the write-lock portion of the read-write lock for the corresponding shared memory area, wherein the write-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and
performing the write access only after successfully obtaining the write-lock portion of the read-write lock and no other thread holds the read-lock portion of the read-write lock.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method for transactional memory using read-write locks is disclosed. Each of a plurality of shared memory areas is associated with a respective read-write lock, which includes a read-lock portion indicating whether any thread has a read-lock for read-only access to the memory area and a write-lock portion indicating whether any thread has a write-lock for write access to the memory area. A thread executing a group of memory access operations as an atomic transaction acquires the proper read or write permissions before performing a memory operation. To perform a read access, the thread attempts to obtain the corresponding read-lock and succeeds if no other thread holds a write-lock for the memory area. To perform a write-access, the thread attempts to obtain the corresponding write-lock and succeeds if no other thread holds a write-lock or read-lock for the memory area.
-
Citations
20 Claims
-
1. A computer-implemented method, comprising:
-
associating each of a plurality of shared memory areas with a respective read-write lock, wherein for each shared memory area the read-write lock includes a read-lock portion indicating whether any thread has a read-lock for read-only access to the associated shared memory area and a write-lock portion indicating whether any thread has a write-lock for write access to the associated shared memory area; a thread executing a set of program instructions including a plurality of memory access operations to shared memory to be completed as an atomic transaction, wherein for each memory access operation of the atomic transaction said executing comprises; if the memory access is a read access; attempting to obtain the read-lock portion of the read-write lock for the corresponding shared memory area, wherein the read-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and performing the read access only after successfully obtaining the read-lock portion of the read-write lock; and if the memory access is a write access; attempting to obtain the write-lock portion of the read-write lock for the corresponding shared memory area, wherein the write-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and performing the write access only after successfully obtaining the write-lock portion of the read-write lock and no other thread holds the read-lock portion of the read-write lock. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A computer-readable storage medium storing program instructions executable by one or more processors to implement:
-
associating each of a plurality of shared memory areas with a respective read-write lock, wherein for each shared memory area the read-write lock includes a read-lock portion indicating whether any thread has a read-lock for read-only access to the associated shared memory area and a write-lock portion indicating whether any thread has a write-lock for write access to the associated shared memory area; a thread executing a set of program instructions including a plurality of memory access operations to shared memory to be completed as an atomic transaction, wherein for each memory access operation of the atomic transaction said executing comprises; if the memory access is a read access; attempting to obtain the read-lock portion of the read-write lock for the corresponding shared memory area, wherein the read-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and performing the read access only after successfully obtaining the read-lock portion of the read-write lock; and if the memory access is a write access; attempting to obtain the write-lock portion of the read-write lock for the corresponding shared memory area, wherein the write-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and performing the write access only after successfully obtaining the write-lock portion of the read-write lock and no other thread holds the read-lock portion of the read-write lock. - View Dependent Claims (11, 12, 13, 14, 15, 16)
-
-
17. A computer system, comprising:
-
one or more processors; a memory coupled to the one or more processors storing program instructions executable by the one or more processors to implement; associating each of a plurality of shared memory areas with a respective read-write lock, wherein for each shared memory area the read-write lock includes a read-lock portion indicating whether any thread has a read-lock for read-only access to the associated shared memory area and a write-lock portion indicating whether any thread has a write-lock for write access to the associated shared memory area; a thread executing a set of program instructions including a plurality of memory access operations to shared memory to be completed as an atomic transaction, wherein for each memory access operation of the atomic transaction said executing comprises; if the memory access is a read access; attempting to obtain the read-lock portion of the read-write lock for the corresponding shared memory area, wherein the read-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and performing the read access only after successfully obtaining the read-lock portion of the read-write lock; and if the memory access is a write access; attempting to obtain the write-lock portion of the read-write lock for the corresponding shared memory area, wherein the write-lock portion is obtained only if no other thread holds the write-lock portion of the read-write lock; and performing the write access only after successfully obtaining the write-lock portion of the read-write lock and no other thread holds the read-lock portion of the read-write lock. - View Dependent Claims (18, 19, 20)
-
Specification