Abort Free SemanticTM by Dependency Aware Scheduling of Transactional Instructions Shlomi Dolev...

16
Abort Free SemanticTM by Abort Free SemanticTM by Dependency Aware Scheduling Dependency Aware Scheduling of Transactional Instructions 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

Transcript of Abort Free SemanticTM by Dependency Aware Scheduling of Transactional Instructions Shlomi Dolev...

Abort Free SemanticTM by Abort Free SemanticTM by Dependency Aware Scheduling Dependency Aware Scheduling of Transactional Instructionsof Transactional Instructions

Shlomi DolevBen-Gurion University of the Negev

Israel

WTM 2013

Panagiota FatourouUniversity of Crete & FORTH-ICS

Greece

Eleftherios KosmasUniversity of Crete & FORTH-ICS

Greece

WTM 2013S. 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 2013S. 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 2013S. Dolev & P. Fatourou & E. Kosmas

Transaction Level Parallelism

p1 p2 pn

2. T1.read(z)

x y z w

1. T1.read(x)

5. T1.write(w)

4. T1.read(w)

3. T1.write(y)

T2.read

T2.write

T2.write

T2.read

Tm.read

Tm.read

Tm.read

T2T1 Tm

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

Transactional Instruction Level Parallelism

p1 p2 pn

2. T1.read

x y z w

1. T1.read

5. T1.write

4.T1.read3. T1.write

dependencies may exist between instructions of the same transaction

T2.read

T2.write

T2.write

T2.read

Tm.read

Tm.read

Tm.read

T2 Tm

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

SemanticTM

p1 p2 pn

T1.read

x y z w

T1.read

T1.write

T1.readT1.write

T2.readT2.write

T2.write

T2.read

Tm.readTm.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

p3

For relatively simple transactions the work of the scheduler can be done at compile time.

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

If the execution of a transactional instruction e2 depends on the execution of a transactional instruction e1

there is a dependency between e1 and e2

input dependency for e2

output dependency for e1

A dependency between a read and a write instruction → data dependency a cond and a read (or a write) instruction → control

dependency

Dependencies

x:=3x++y:=x

if ( ) then x:=1

x+y = 5

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

x:=3x++y:=x

write(x,3)tmp1 := read(x)write(x,tmp1+1)tmp2 := read(x)write(y,tmp2)

write write

00

x y

read

writedata dep

p1 p2

read

Reads and Writes

0 0434

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

if(x+y = 5) then x := 1

tmp1 := read(x)tmp2 := read(y)tmp3 := tmp1+tmp2 cond(tmp3=5) write(x,1)

x y

read

cond

write

data dep

control dep

p1 p2

If cond evaluates to TRUE then the write is executedOtherwise it is invalidated

read

Conditionals – if statement

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

if(x = 1) then x := 2else x := 4y := x

tmp1 := read(x)cond(tmp1 = 1) write(x,2)cond(tmp1 <> 1) write (x,4)tmp2 := read(x)write(y,tmp2)

x y

read write

cond

cond

write

write

read

data dep

control dep

p1 p2

Conditionals – if..else statements

0404

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

Loops

while(x < 10) do y := x x := 2* x

tmp1 := read(x)cond(tmp1 < 10, loop) tmp2 := read(x) write(y,tmp2) tmp3 := 2 * tmp2

write(x,tmp3) tmp1 := read(x)

x y

read

cond

read

write

write

readcontrol

dep

data dep

across iteration data

dep

WTM 2013S. Dolev & P. Fatourou & E. Kosmas

Loops

01

x y

read

cond

read

output data dep

control dep

write

write

read

across iteration data

dep

0 000

0

0

0

0Metadata

01

1

1

1

1

0 01 0 1 111 2

2

2

2

2

2 222

while (x < 10) y := x x := x*2

44 444

4

4

4

4

Metadata

p1 p2

12 24 816

WTM 2013S. 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 statusval iter

for the value of each t-variable version

CAS object update using oldvalue

iteration number

CAS object

val read

ver ver1

oldval iterwrite

1

WTM 2013S. 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 readread

write

read

read read

read: A[*]

write: A[*]

read: A[3]

write: A[2]

read: A[*]

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 2013S. 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 2013S. Dolev & P. Fatourou & E. Kosmas

QUESTIONS?

Thank you!