Efficient and consistent software transactional memory
First Claim
1. A method comprising:
- storing a global transaction value, which is to represent a most recent committed transaction, in a first local transaction value associated with a first transaction, in response to starting execution of the first transaction;
maintaining a current version value for a data address in a meta-data location associated with the data address, the current version value being based on the global transaction value that is associated with a most recent transaction to update the data address;
in response to encountering a current read operation, which is included in the first transaction and references the data address,reading the current version value from the meta-data location associated with the data address,checking if the current version value indicates the data address is unlocked, andvalidating a plurality of previous read operations from the first transaction responsive to the current version value from the meta-data location associated with the data address being greater than the local transaction value to indicate a more recent transaction than the first transaction has updated the data address;
performing the current read operation;
after performing the current read operation,loading a subsequent version value from the meta-data location associated with the data address, andaborting the first transaction in response to the subsequent version value from the meta-data location being different from the logged version value;
in response to encountering a write operation referencing the data address, acquiring a lock in the meta-data location associated with the data address; and
attempting to commit the transaction in response in response to encountering an end of the transaction.
1 Assignment
0 Petitions
Accused Products
Abstract
A method and apparatus for efficient and consistent validation/conflict detection in a Software Transactional Memory (STM) system is herein described. A version check barrier is inserted after a load to compare versions of loaded values before and after the load. In addition, a global timestamp (GTS) is utilized to track a latest committed transaction. Each transaction is associated with a local timestamp (LTS) initialized to the GTS value at the start of a transaction. As a transaction commits it updates the GTS to a new value and sets versions of modified locations to the new value. Pending transactions compare versions determined in read barriers to their LTS. If the version is greater than their LTS indicating another transaction has committed after the pending transaction started and initialized the LTS, then the pending transaction validates its read set to maintain efficient and consistent transactional execution.
23 Citations
27 Claims
-
1. A method comprising:
-
storing a global transaction value, which is to represent a most recent committed transaction, in a first local transaction value associated with a first transaction, in response to starting execution of the first transaction; maintaining a current version value for a data address in a meta-data location associated with the data address, the current version value being based on the global transaction value that is associated with a most recent transaction to update the data address; in response to encountering a current read operation, which is included in the first transaction and references the data address, reading the current version value from the meta-data location associated with the data address, checking if the current version value indicates the data address is unlocked, and validating a plurality of previous read operations from the first transaction responsive to the current version value from the meta-data location associated with the data address being greater than the local transaction value to indicate a more recent transaction than the first transaction has updated the data address; performing the current read operation; after performing the current read operation, loading a subsequent version value from the meta-data location associated with the data address, and aborting the first transaction in response to the subsequent version value from the meta-data location being different from the logged version value; in response to encountering a write operation referencing the data address, acquiring a lock in the meta-data location associated with the data address; and attempting to commit the transaction in response in response to encountering an end of the transaction. - View Dependent Claims (2, 3, 4)
-
-
5. A tangible storage medium including program code which, when executed by a machine, causes the machine to perform the operations of:
-
copying a global timestamp that represents a most recent committed transaction to a local timestamp for a transaction; determining a current version from a meta-data location associated with an address referenced by a load operation in the transaction before the load operation is performed, wherein the transaction comprises a plurality of grouped operations, and wherein updates from the plurality of grouped operations are not made globally visible outside of the transaction until the transaction is committed; logging the current version as a logged version; determining if the current version is greater than the local timestamp; validating a plurality of previous reads in the transaction in response to determining if the current version is greater than the local timestamp; after performing the load operation and before an attempted commit of the transaction; determining a subsequent version from the meta-data location associated with the address, and aborting the transaction in response to the subsequent version being different from the logged version indicating a transaction wrote to the address since determining the current version from the meta-data location. - View Dependent Claims (6, 7, 8, 9, 10, 11, 12)
-
-
13. A system comprising:
-
a device to hold program code; and a processor associated with the memory device, wherein the program code, when executed by the processor, is to cause the processor to perform the operations of; loading a global timestamp into a local timestamp associated with the first transaction, wherein the global timestamp is to be based on a most recent local timestamp value of a most recent committed transaction; determining if a first version held in a version location associated with an address referenced by a load operation within the first transaction is greater than the local timestamp before performing the load operation; aborting the first transaction in response to determining a previous read in the first transaction is not valid responsive to determining the first version is greater than the local timestamp; determining a second version held in the version location associated with the address after performing the load operation; and aborting the first transaction in response to determining the second version is different from the first version. - View Dependent Claims (14, 15, 16, 17, 18)
-
-
19. A tangible storage medium including compiler code which, when executed by a machine, causes the machine to perform the operations of:
-
detecting a transaction in program code held in the machine; inserting a first instruction at the start of the transaction, the first instruction, when executed, to initialize a local variable, which is to be associated with the transaction, to a value of a global variable that is to represent a value of a most recent committed transaction; detecting a load operation referencing an address in the first transaction; inserting a call to a read barrier function before the load operation, wherein the read barrier function, when executed by a machine, causes the machine to perform the operations of;
determining a first version held in a meta-data location associated with the address, determining if the first version is greater than the local timestamp, and in response to the first versions being greater than the local timestamp;reloading the global timestamp into the local timestamp, determining if a plurality of previous reads in the first transaction are valid; aborting the first transaction in response to one of the plurality of previous reads in the first transaction not being valid; and logging the first version; and inserting a call to a version check function after the load operation and before a commit point of the transaction, wherein the version check function, when executed by a machine, causes the machine to further perform the operations of;
determining a second version held in the version location associated with the address, determining if the second version is different from the first version; and
aborting the first transaction, in response to the second version being different from the first version. - View Dependent Claims (20, 21, 22, 23)
-
-
24. A tangible storage medium including code which, when executed by a machine, causes the machine to perform the operations of:
-
storing a global transaction value, which is to represent a most recent committed transaction, in a first local transaction value associated with a first transaction, in response to starting execution of the first transaction; maintaining a current version value for a data address in a meta-data location associated with the data address, the current version value being based on the global transaction value that is associated with a most recent transaction to update the data address; and in response to encountering a current read operation, which is included in the first transaction and references the data address, reading the current version value from the meta-data location associated with the data address, checking if the current version value indicates the data address is unlocked, logging the current version value as a logged version value in response to the first address being unlocked, validating a plurality of previous read operations from the first transaction responsive to the current version value from the meta-data location associated with the data address being greater than the local transaction value to indicate a more recent transaction than the first transaction has updated the data address; and performing the current read operation; and after performing the current read operation, loading a subsequent version value from the meta-data location associated with the data address, and aborting the first transaction in response to the subsequent version value from the meta-data location being different from the logged version value. - View Dependent Claims (25, 26, 27)
-
Specification