Abort Free Semantic TM by Dependency Aware Scheduling
Abort Free Semantic. TM by Dependency Aware Scheduling of Transactional Instructions Panagiota Fatourou Shlomi Dolev Ben-Gurion University of the Negev Israel University of Crete & FORTH-ICS Greece Eleftherios Kosmas University of Crete & FORTH-ICS Greece WTM 2013
Introduction When two transactions conflict, most TM systems abort one of them to ensure consistency Two transactions conflict, if they both access the same t-variable and at least one of these accesses is a write 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 S. Dolev & P. Fatourou & E. Kosmas WTM 2013
Our Result Semantic. TM an opaque TM algorithm no transaction ever aborts An execution of a TM algorithm is opaque if it satisfies strict serializability and active transactions read “consistent” values for t-variables guarantees wait-freedom/local progress for the execution of transactions fine-grain parallelism at the transactional instruction level S. Dolev & P. Fatourou & E. Kosmas WTM 2013
Transaction Level Parallelism x y z w 1. T 1. read(x) T 1 2. T 1. read(z) 3. T 1. write(y) 4. T 1. read(w) 5. T 1. write(w) p 1 T 2. read T 2. write p 2 S. Dolev & P. Fatourou & E. Kosmas Tm Tm. read pn WTM 2013
Transactional Instruction Level Parallelism x 1. y T 1. read 3. z T 1. write 2. w T 1. read 4. T 1. read 5. T 1. write dependencies may exist between instructions of the same transaction T 2. read T 2. write p 1 p 2 S. Dolev & P. Fatourou & E. Kosmas Tm Tm. read pn WTM 2013
Semantic. TM 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 x y z w T 1. read T 1. write T 1. read T 2. write T 2. read T 1. write Tm. read T 2. write Tm. read t-var lists Tm. read p 1 p 2 p 3 pn S. Dolev & P. Fatourou & E. Kosmas For relatively simple transactions the work of the scheduler can be done at compile time. WTM 2013
Dependencies 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 x: =3 x++ y: =x A dependency between a read and a write instruction → data dependency a cond a read (or a write) instruction → control dependency if ( x+y = 5) then x: =1 S. Dolev & P. Fatourou & E. Kosmas WTM 2013
Reads and Writes 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) x y 4 3 0 4 0 write read data dep write read p 1 S. Dolev & P. Fatourou & E. Kosmas p 2 WTM 2013
Conditionals – if statement x 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) If cond evaluates to TRUE then the write is executed Otherwise it is invalidated S. Dolev & P. Fatourou & E. Kosmas read y data dep read cond write p 1 control dep p 2 WTM 2013
Conditionals – if. . else statements 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) x y 4 0 read data dep write cond write control dep read p 1 S. Dolev & P. Fatourou & E. Kosmas p 2 WTM 2013
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) x read y data dep write cond read across iteration data dep write read S. Dolev & P. Fatourou & E. Kosmas control dep WTM 2013
Loops while (x < 10) y : = x x : = x*2 Metadata 2 4 0 1 0 2 4 1 x y 16 4 2 1 2 8 0 1 read 0 2 4 1 cond 0 2 4 1 read 2 4 0 1 write 0 2 4 1 read output data dep Metadata write 0 2 4 1 across iteration data dep control dep p 1 S. Dolev & P. Fatourou & E. Kosmas p 2 WTM 2013
Synchronization x 1 status ver read valval iter for each transactional instruction y together with the value of each input data dependency iteration number CAS object status (ACTIVE, DONE) 1 ver write oldval iter for the value of each tvariable version CAS object update using oldvalue iteration number CAS object for each control dependency CAS object S. Dolev & P. Fatourou & E. Kosmas WTM 2013
Extensions Support of transactions accessing t-variables that are known at run time A[*] accessing an element of an array A[1] A[2] A[3] read: A[*] A[m] write: A[*] read: A[3] write: A[2] read write read read: A[*] write: A[*] Dynamic transactions similar strategy as above, if we consider the memory heap as an array Nested conditionals & loops (cond c 2 in the block of outer cond c 1) add a control dependency from c 1 to c 2 but not to the instructions of the block of c 2. S. Dolev & P. Fatourou & E. Kosmas WTM 2013
Conclusion & Future Work Summary We presented Semantic. TM: executes transactions without ever causing any aborts parallelism is fine-grained achieved at the level of transactional instructions Blocking version of Semantic. TM Future Work Implement an optimized version of Semantic. TM Experimental Study S. Dolev & P. Fatourou & E. Kosmas WTM 2013
Thank you! QUESTIONS? S. Dolev & P. Fatourou & E. Kosmas WTM 2013
- Slides: 16