01.12.2012 Views

Architecture of Computing Systems (Lecture Notes in Computer ...

Architecture of Computing Systems (Lecture Notes in Computer ...

Architecture of Computing Systems (Lecture Notes in Computer ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Efficient Transaction Nest<strong>in</strong>g <strong>in</strong> Hardware Transactional Memory 141<br />

3.2 The Scheme <strong>of</strong> Conditional Partial Rollback<br />

The ideal method to improve performance <strong>of</strong> closed nest<strong>in</strong>g is: when a transaction<br />

aborts due to a conflict with other transactions, it just rolls back to the beg<strong>in</strong>n<strong>in</strong>g<br />

<strong>of</strong> itself <strong>in</strong>stead <strong>of</strong> the outermost transaction. However, this requires that each<br />

nested transaction has its own data set, as <strong>in</strong> the nested LogTM, and will <strong>in</strong>crease<br />

complexities and costs <strong>of</strong> hardware significantly.<br />

To improve the performance <strong>of</strong> closed nest<strong>in</strong>g <strong>in</strong> reasonable hardware cost, we<br />

propose a scheme which supports conditional partial rollback (CPR) <strong>of</strong> transactions.<br />

The idea <strong>of</strong> the scheme is: <strong>in</strong>stead <strong>of</strong> ma<strong>in</strong>ta<strong>in</strong><strong>in</strong>g <strong>in</strong>dependent data set<br />

for each nest<strong>in</strong>g level, a global data set is used for all <strong>of</strong> the nested transactions,<br />

while the access status <strong>of</strong> each nest<strong>in</strong>g level to the data set is recorded. When an<br />

<strong>in</strong>ner level transaction aborts due to a conflict, it rolls back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong><br />

itself if the data set it accessed has no overlap with other transactions, otherwise<br />

it rolls back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> the outer-level transaction which accessed same<br />

data with it, <strong>in</strong> the worst case, it rolls back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> the outermost<br />

transaction.<br />

In addition, the partial rollback can be further dist<strong>in</strong>guished by read/write<br />

accesses. Only when the conflicted transaction has written to the same data with<br />

other transactions, it rolls back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> the outer-level transaction.<br />

The reason is that the data updated by the outer-level transactions has been<br />

overwritten by the conflicted transaction <strong>in</strong> the later, and cannot be restored<br />

to the beg<strong>in</strong>n<strong>in</strong>g status <strong>of</strong> conflicted transaction, <strong>in</strong> that case, a rollback to the<br />

beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> the outer-level transaction is needed. In other cases, the conflicted<br />

transaction just rolls back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> itself despite it has accessed the<br />

same data with other transactions.<br />

The above CPR scheme can be described formally as follow<strong>in</strong>g: suppose the<br />

number <strong>of</strong> nest<strong>in</strong>g level is n, the outermost transaction is T0, the <strong>in</strong>nermost transaction<br />

is Tn−1, and write set <strong>of</strong> each nested transaction are: D0,D1,...,Dn−1.<br />

When transaction Tc aborts due to a conflict, it rolls back to the beg<strong>in</strong>n<strong>in</strong>g<br />

<strong>of</strong> transaction Tm, and:<br />

m =m<strong>in</strong>{∀i∀j[(Dc ∩ Di �= ∅) ∧ (Di ∩ Dj = ∅)]} . (1)<br />

(i =0, 1, 2,...,c; j =0, 1, 2,...,i− 1)<br />

Accord<strong>in</strong>g to the above expression, the transaction Tc will roll back to the transaction<br />

that is the outermost among the transactions that have overlapped write<br />

set with Tc. If there is no overlapped write set between Tc and others, it will just<br />

roll back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> itself.<br />

Fig. 1 gives an example <strong>of</strong> conditional partial rollback. Accord<strong>in</strong>g to the flatten<strong>in</strong>g<br />

model for closed nest<strong>in</strong>g, an <strong>in</strong>ner transaction Tc rolls back to the outermost<br />

transaction when conflict occurs, as shown <strong>in</strong> Fig. 1(a). For CPR scheme,<br />

the transaction rolls back to the beg<strong>in</strong>n<strong>in</strong>g <strong>of</strong> itself if there is no overlap between<br />

its write set and others, as shown <strong>in</strong> Fig. 1(b); otherwise it rolls back to the outer<br />

transaction which has overlapped write set with Tc , as shown <strong>in</strong> Fig. 1(c).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!