Abort Free SemanticTM by Dependency Aware Scheduling of Transactional Instructions Shlomi Dolev Ben-Gurion University of the Negev Israel WTM 2013 Panagiota Fatourou University of Crete & FORTH-ICS Greece Eleftherios Kosmas University of Crete & FORTH-ICS Greece
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas When two transactions conflict, most TM systems abort one of them to ensure consistency Ideally: All transactions should commit Parallelism should not be sacrificed TMs that never abort transactions are highly desirable support of irrevocable transactions avoid the cost of re-executing aborted transactions Two transactions conflict, if they both access the same t-variable and at least one of these accesses is a write Introduction
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas SemanticTM an opaque TM algorithm no transaction ever aborts guarantees wait-freedom/local progress for the execution of transactions fine-grain parallelism at the transactional instruction level An execution of a TM algorithm is opaque if it satisfies strict serializability and active transactions read “consistent” values for t-variables Our Result
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Transaction Level Parallelism p1p1 p2p2 pnpn 2. T 1.read(z) x yzw 1. T 1.read(x) 5. T 1.write(w) 4. T 1.read(w) 3. T 1.write(y) T 2.read T 2.write T 2.read T m.read T2T2 T1T1 TmTm
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Transactional Instruction Level Parallelism p1p1 p2p2 pnpn 2. T1.read x yzw 1. T1.read 5. T1.write 4. T1.read 3. T1.write dependencies may exist between instructions of the same transaction T2. read T2. write T2. read Tm. read T2T2 TmTm
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas SemanticTM p1p1 p2p2 pnpn T1.read x yz w T1.write T1.read T1.write T2.readT2.write T2.read Tm.read t-var lists a scheduler places transactional intructions into t-var lists together with their dependencies transactions are processed by the scheduler the one after the other each process randomly chooses a t-var list and executes its ready instructions no conflicts occur between transactions p3p3 For relatively simple transactions the work of the scheduler can be done at compile time.
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas If the execution of a transactional instruction e 2 depends on the execution of a transactional instruction e 1 there is a dependency between e 1 and e 2 input dependency for e 2 output dependency for e 1 A dependency between a read and a write instruction → data dependency a cond and a read (or a write) instruction → control dependency Dependencies x:=3 x++ y:=x if ( ) then x:=1 x+y = 5
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas x:=3 x++ y:=x write(x,3) tmp 1 := read(x) write(x,tmp 1 +1) tmp 2 := read(x) write(y,tmp 2 ) write 0 0 xy read write data dep p1p1 p2p2 read Reads and Writes
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas if(x+y = 5) then x := 1 tmp 1 := read(x) tmp 2 := read(y) tmp 3 := tmp 1 +tmp 2 cond(tmp 3 =5) write(x,1) xy read cond write data dep control dep p1p1 p2p2 If cond evaluates to TRUE then the write is executed Otherwise it is invalidated read Conditionals – if statement
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas if(x = 1) then x := 2 else x := 4 y := x tmp 1 := read(x) cond(tmp 1 = 1) write(x,2) cond(tmp 1 <> 1) write (x,4) tmp 2 := read(x) write(y,tmp 2 ) xy readwrite cond write read data dep control dep p1p1 p2p2 Conditionals – if..else statements 04 04
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Loops while(x < 10) do y := x x := 2* x tmp 1 := read(x) cond(tmp 1 < 10, loop) tmp 2 := read(x) write(y,tmp 2 ) tmp 3 := 2 * tmp 2 write(x,tmp 3 ) tmp 1 := read(x) xy read cond read write read control dep data dep across iteration data dep
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Loops 0 1 xy read cond read output data dep control dep write read across iteration data dep Metadata while (x < 10) y := x x := x* Metadata p1p1 p2p
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Synchronization for each transactional instruction status ( ACTIVE, DONE ) together with the value of each input data dependency iteration number CAS object for each control dependency CAS object x y status val iter for the value of each t- variable version CAS object update using oldvalue iteration number CAS object valread ver 1 oldval iter write 1
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Support of transactions accessing t-variables that are known at run time accessing an element of an array Extensions A[1] A[2]A[3]A[m] read write read read: A[*] write: A[*] read: A[3] write: A[2] read: A[*] write: A[*] A[*] Dynamic transactions similar strategy as above, if we consider the memory heap as an array Nested conditionals & loops (cond c2 in the block of outer cond c1) add a control dependency from c1 to c2 but not to the instructions of the block of c2.
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas Summary We presented SemanticTM: executes transactions without ever causing any aborts parallelism is fine-grained achieved at the level of transactional instructions Blocking version of SemanticTM Future Work Implement an optimized version of SemanticTM Experimental Study Conclusion & Future Work
WTM 2013 S. Dolev & P. Fatourou & E. Kosmas QUESTIONS? Thank you!