Lock mechanism to enable atomic updates to shared memory
First Claim
1. A method for reading a location in a shared memory, the method comprising:
- receiving a shared memory read instruction for the location in the shared memory for multiple parallel threads of a program;
determining that the shared memory read instruction includes a lock command suffix indicating that a lock of the location is requested; and
returning a lock result indicating whether or not the lock of the location was acquired for the shared memory read instruction, wherein execution across the multiple parallel threads diverges when the lock result indicates that at least one of the multiple parallel threads did not acquire the lock.
0 Assignments
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.
13 Citations
17 Claims
-
1. A method for reading a location in a shared memory, the method comprising:
-
receiving a shared memory read instruction for the location in the shared memory for multiple parallel threads of a program; determining that the shared memory read instruction includes a lock command suffix indicating that a lock of the location is requested; and returning a lock result indicating whether or not the lock of the location was acquired for the shared memory read instruction, wherein execution across the multiple parallel threads diverges when the lock result indicates that at least one of the multiple parallel threads did not acquire the lock. - View Dependent Claims (2, 3, 4, 5, 6, 7, 8, 9)
-
-
10. A method for writing a location in a shared memory with a value, the method comprising:
-
receiving a shared memory write instruction for the location in the shared memory for multiple parallel threads of a program; determining that the shared memory write instruction includes an unlock command suffix indicating that a lock of the location should be released; determining, based on a lock result, threads of the multiple parallel threads that acquired a lock, wherein execution across the multiple parallel threads diverges when the lock result indicates that at least one of the multiple parallel threads did not acquire the lock; and storing the value in the location in the shared memory for the threads of the multiple parallel threads that acquired the lock. - View Dependent Claims (11, 12, 13, 14, 15, 16, 17)
-
Specification