Lock mechanism to enable atomic updates to shared memory
First Claim
1. A method for performing atomic updates to a shared memory, the method comprising:
- receiving a memory request for accessing an entry of the shared memory corresponding to an address;
determining a lock address of a lock entry that stores a lock flag using the address;
computing a lock result for the lock address that indicates whether or not a lock is acquired for the entry of the shared memory corresponding to the address;
setting the lock flag to indicate that the entry is locked by the memory request to prevent another memory request from writing the entry of the shared memory corresponding to the address; and
reading data stored in the entry of the shared memory corresponding to the address,wherein the steps of determining, computing, setting, and reading are performed in parallel for multiple execution threads of a program, and the execution of the threads diverges when lock results for the multiple threads indicate that at least one of the multiple threads did not acquire a lock.
1 Assignment
0 Petitions
Accused Products
Abstract
A system and method for locking and unlocking access to a shared memory for atomic operations provides immediate feedback indicating whether or not the lock was successful. Read data is returned to the requestor with the lock status. The lock status may be changed concurrently when locking during a read or unlocking during a write. Therefore, it is not necessary to check the lock status as a separate transaction prior to or during a read-modify-write operation. Additionally, a lock or unlock may be explicitly specified for each atomic memory operation. Therefore, lock operations are not performed for operations that do not modify the contents of a memory location.
-
Citations
18 Claims
-
1. A method for performing atomic updates to a shared memory, the method comprising:
-
receiving a memory request for accessing an entry of the shared memory corresponding to an address; determining a lock address of a lock entry that stores a lock flag using the address; computing a lock result for the lock address that indicates whether or not a lock is acquired for the entry of the shared memory corresponding to the address; setting the lock flag to indicate that the entry is locked by the memory request to prevent another memory request from writing the entry of the shared memory corresponding to the address; and reading data stored in the entry of the shared memory corresponding to the address, wherein the steps of determining, computing, setting, and reading are performed in parallel for multiple execution threads of a program, and the execution of the threads diverges when lock results for the multiple threads indicate that at least one of the multiple threads did not acquire a lock. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A non-transitory computer readable storage medium storing instructions for causing a processor to access a shared memory by performing the steps of:
-
receiving a memory request for accessing an entry of the shared memory corresponding to an address; determining a lock address of a lock entry that stores a lock flag using the address; computing a lock result for the lock address that indicates whether or not a lock is acquired for the entry of the shared memory corresponding to the address; setting the lock flag to indicate that the entry is locked by the memory request to prevent another memory request from writing the entry of the shared memory corresponding to the address; and reading data stored in the entry of the shared memory corresponding to the address, wherein the steps of determining, computing, setting, and reading are performed in parallel for multiple execution threads of a program, and the execution of the threads diverges when lock results for the multiple threads indicate that at least one of the multiple threads did not acquire a lock. - View Dependent Claims (11, 12, 13)
-
-
14. A system for performing atomic updates to a shared memory, the system comprising:
-
a shared storage resource to store data in multiple entries and configured to; receive a memory request for accessing an entry of the shared storage resource corresponding to an address; and output data stored in the entry corresponding to the address; and a memory lock unit coupled to the shared storage resource and configured to; receive a lock request that is specified with the memory request; determine a lock address of a lock entry that stores a lock flag using the address; and set the lock flag to indicate that the entry is locked by the memory request to prevent another memory request from writing the entry of the shared storage resource corresponding to the address, wherein determining the lock address and setting the lock flag are performed in parallel for multiple execution threads of a program, and the execution of the threads diverges when lock results for the multiple threads indicate that at least one of the multiple threads did not set the lock flag. - View Dependent Claims (15, 16, 17, 18)
-
Specification