I've been reading the paper Software Transactional Memory
by Shavit and Touitou. I understand how STM works in general but I need to understand this paper as it is the founding paper of the concept. However, I'm missing something rather fundamental of transactions. When I reed through the paper I never see what happens when a transaction fails. In general STM should retry a transaction when it fails, until it succeeds.
What the paper proposes is the following:
When a transaction starts it acquires the ownership of all the memory locations. Next, it computes the new values of each memory reference and writes them back to global memory. Finally, the transaction releases the ownerships. The transaction has succeeded and returns "success".
If a transaction tries to acquire ownership of a memory reference that is already owned by another transaction it will "help" this transaction by running the same transaction. But only if the owning transaction is not in the failed
state or success
state.
A transaction goes into the success
state when it has successfully acquired all the locks. It goes into the failed
state when
But, nowhere in the paper can I find something about retrying a transaction?
For example, I have applied the pseudocode in the text to this scenario:
Suppose a transaction T1
that wants to run on dataset [A, B, C]
and a transaction T2
that wants to run on dataset [C, D, E]
. No other transactions are running in the system.
In order of execution:
T1
successfully acquires the locks forA
,B
andC
T1
now has the statesuccess
because it acquired all the ownerships.T2
wants to acquire the locks forC
,D
andE
.T2
can not acquire the lock forC
.T2
its status changes toFailure
T2
releases all the ownerships it had (none at the moment)T2
knows thatC
is the reference that caused the failure.T2
executes the same transaction as the process that ownsC
.T2
notices thatT1
already is in thesuccess
state so it aborts.T1
safely executes its transactions and commits the changes to the global memory
So nowhere in this scenario is T1
executed again?
Any insights are greatly appreciated!