Checkpoints and Continuations
instead of
Nested Transactions
Eric Koskinen
Brown University
Joint work with
Maurice Herlihy
Brown University
Checkpoints and Continuations instead of Nested Transactions Eric - - PowerPoint PPT Presentation
Checkpoints and Continuations instead of Nested Transactions Eric Koskinen Brown University Joint work with Maurice Herlihy Brown University Partial Aborts Early TMs aborted entire transactions Useful to partially abort Performance:
Brown University
Joint work with
Brown University
atomic { Object x = swap(htA, key, y); HashTable.Insert(htB, key, x); } Object swap(HashTable ht, int key , Object newVal) { atomic { Object r = HashTable Remove(ht,key); HashTable Insert ( ht , key , newVal); return r ; } }
global int list[10]; atomic { int x = list[0]; list[1] = x + 1; atomic { list[2] = x + 3; } ... }
Conflict!
atomic { int x = list[0]; list[1] = x + 1; atomic { list[2] = x + 3; ... } }
void foo() { atomic { ... } } atomic { foo(); }
void foo() { if(_txn) { checkpoint; ... } else atomic { ... } } atomic { foo(); }
atomic { int x = list[0]; list[1] = x + 1; checkpoint; list[2] = x + 3; ... }
read(list[0]) write(list[1]) write(list[2]) read(list[9]) ◆ read(list[0]) write(list[1]) ◆ write(list[2]) read(list[9]) ... ◆ ctx0 read(list[0]) write(list[1]) ◆ ctx1 write(list[2]) read(list[9]) ...
Thread A
atomic { int x = list[0]; list[1] = x + 1; checkpoint; list[2] = x + 3; int y = list[9]; ... }
w
x
y z
Thread A
global ConcurrentSet l; atomic { AbstactLock(3); if(l.insert(3)) LogInverse(l.remove(3)); checkpoint; AbstactLock(7); if(l.remove(7)) LogInverse(l.add(7)); }
Concurrent Data Structure
◆ ctx0 lock(w) foo-1(w) ◆ ctx1 lock(x) bar-1(x) ... ◆ ctx0 read(list[0]) write(list[1]) ◆ ctx1 write(list[2]) read(list[9]) ...
w
x
y z
Thread
Thread
List inbound, outbound; AbstractLock inL, outL; Object in = NULL; atomic { with(inL.lock()) { Prepare(inbound); } checkpoint; in = with(inL.lock()) { Dequeue(inbound); } if ( !in.isSpecial() ) retry; with(outL.lock()) { Enqueue(outbound. in); } }
HashTable htA, htB, htC; AbstractLock alA, alB, alC; atomic { Object result = with(alA.lock(key)) { Remove(htA, key); } checkpoint; { with(alB.lock(key)) { Remove(htB, key); } with(alB.lock(key)) { Add(htB, key, result); } }
{ with(alC.lock(key)) { Remove(htC, key); } with(alC.lock(key)) { Add(htC, key, result); } } }
w
x
y z
Concurrent Data Structure
HP Txn LP Txn
Conflict!
Simple benchmark, engineered to produce HP/LP contention
vacation (flat) vacation (checkpoints) kmeans (flat) kmeans (checkpoints)
Moravan et al. Supporting Nested Transactional Memory in LogTM. ASPLOS-XII.
. Ni et al. Open Nesting in Software Transactional
. This paper: Herlihy, Koskinen. Checkpoints and Continuations instead of Nested Transactions. Transact 2008.