Slide 1

Slide 1 text

Deterministic transactional execution Tiago Vale1 João Silva1 Ricardo Dias12 João Lourenço1 1NOVA LINCS / UNL 2SUSE Linux GmbH

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

read/write read/write

Slide 4

Slide 4 text

Coordinate operations that access shared state using TM transaction { read this do something write that } Only specify what should be atomic, system ensures it!

Slide 5

Slide 5 text

Coordinate operations that access shared state using TM transaction { read this do something write that }

Slide 6

Slide 6 text

Transactions appear to execute one at a time

Slide 7

Slide 7 text

Transactions appear to execute one at a time in any order = A = B = C

Slide 8

Slide 8 text

“Heisenbugs”

Slide 9

Slide 9 text

“Heisenbugs” ~70% of concurrency bugs!* *Learning from mistakes: a comprehensive study on real world concurrency bug characteristics, ASPLOS 2008

Slide 10

Slide 10 text

Fault tolerance = B Replica 1 Replica 2 A ≠ B = A

Slide 11

Slide 11 text

Deterministic transaction order helps building reliable concurrent software

Slide 12

Slide 12 text

“Heisenbugs”

Slide 13

Slide 13 text

Fault tolerance Replica 1 Replica 2 A = A = A = A

Slide 14

Slide 14 text

Motivation Deterministic transaction execution Evaluation Outline

Slide 15

Slide 15 text

2. Commit phase Crash course in TM 1. Speculative phase

Slide 16

Slide 16 text

y x Shared state 1. Speculative phase

Slide 17

Slide 17 text

reads writes 1. Speculative phase y x

Slide 18

Slide 18 text

reads writes read(x) 1. Speculative phase y x

Slide 19

Slide 19 text

reads writes read(x) 1. Speculative phase y x x

Slide 20

Slide 20 text

reads writes read(x) write(x) 1. Speculative phase y x x

Slide 21

Slide 21 text

reads x writes x read(x) write(x) y x 1. Speculative phase

Slide 22

Slide 22 text

reads writes reads writes x x y read(x) write(x) read(x) read(y) write(x) y x x x 1. Speculative phase

Slide 23

Slide 23 text

reads writes Commit read(x) write(x) read(x) read(y) write(x) y x x x reads writes x x y 2. Commit phase

Slide 24

Slide 24 text

read(x) reads write(x) writes read(x) read(y) write(x) x x = ? y x x x reads writes x x y 2. Commit phase

Slide 25

Slide 25 text

read(x) reads write(x) writes read(x) read(y) write(x) y y = ? y x x x reads writes x x y 2. Commit phase

Slide 26

Slide 26 text

read(x) reads write(x) writes read(x) read(y) write(x) y x x x reads writes x x y 2. Commit phase

Slide 27

Slide 27 text

read(x) reads write(x) writes read(x) read(y) write(x) Commit y x x x reads writes x x y 2. Commit phase

Slide 28

Slide 28 text

read(x) reads write(x) writes read(x) read(y) write(x) x x = ? y x x x reads writes x x y 2. Commit phase

Slide 29

Slide 29 text

read(x) reads write(x) writes read(x) read(y) write(x) read(x) write(x) y x x x reads writes x x y 1. Speculative phase

Slide 30

Slide 30 text

read(x) reads write(x) writes read(x) read(y) write(x) read(x) write(x) Commit y x x x reads writes x x y 2. Commit phase

Slide 31

Slide 31 text

read(x) reads write(x) writes read(x) read(y) write(x) read(x) write(x) y x x x reads writes x x y 2. Commit phase

Slide 32

Slide 32 text

read(x) reads write(x) writes read(x) read(y) write(x) read(x) write(x) y x x x reads writes x x y 2. Commit phase

Slide 33

Slide 33 text

Define a deterministic transaction order Guarantee execution respects predefined order Key challenges

Slide 34

Slide 34 text

Sequencer Ordering transactions

Slide 35

Slide 35 text

Example sequencer Sequencer

Slide 36

Slide 36 text

Example sequencer Sequencer Replica 1 Replica 2

Slide 37

Slide 37 text

Define a deterministic transaction order • Sequencer Guarantee execution respects predefined order Key challenges

Slide 38

Slide 38 text

Ordered commits 1 2

Slide 39

Slide 39 text

Commit? 1 2 Ordered commits

Slide 40

Slide 40 text

Commit? 1 2 Ordered commits

Slide 41

Slide 41 text

ZZZ… 1 2 Ȭ Ordered commits

Slide 42

Slide 42 text

Commit? 1 2 ȭ Ordered commits

Slide 43

Slide 43 text

Commit? 1 2 ȭ Ordered commits

Slide 44

Slide 44 text

Hmm? 1 2 Ȯ Ordered commits

Slide 45

Slide 45 text

Commit! 1 2 Ordered commits

Slide 46

Slide 46 text

Define a deterministic transaction order • Sequencer Guarantee execution respects predefined order • Ordered commits Key challenges

Slide 47

Slide 47 text

1 2 3 Fast execution mode

Slide 48

Slide 48 text

Speculation mechanisms 1 2 3 Fast execution mode

Slide 49

Slide 49 text

Speculation mechanisms 1 2 3 Fast execution mode

Slide 50

Slide 50 text

1 2 3 Fast execution mode

Slide 51

Slide 51 text

1 2 3 Fast execution mode

Slide 52

Slide 52 text

1 2 3 Fast execution mode

Slide 53

Slide 53 text

1 2 3 Fast execution mode

Slide 54

Slide 54 text

1 2 3 Fast execution mode

Slide 55

Slide 55 text

Define a deterministic transaction order • Sequencer Guarantee execution respects predefined order • Ordered commits • Fast execution mode Key challenges

Slide 56

Slide 56 text

Implementation Software TM: • Fast mode: No read set, validation, write set, write back

Slide 57

Slide 57 text

Implementation Software TM: • Fast mode: No read set, validation, write set, write back Hardware TM (IBM POWER): • Ordered commits: Suspended transactional mode • Fast mode: Rollback-only transactions See for +details

Slide 58

Slide 58 text

Motivation Deterministic transaction execution Evaluation Outline

Slide 59

Slide 59 text

Software transactional memory (see paper for + detail) • Slowdown of deterministic execution? • Is the fast execution mode faster? • Do transactions wait less? Hardware transactional memory (see paper) Evaluation See for +details

Slide 60

Slide 60 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 Deterministic execution (STAMP trend)

Slide 61

Slide 61 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 Nondeterministic Deterministic execution (STAMP trend)

Slide 62

Slide 62 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 Nondeterministic This work Deterministic execution (STAMP trend)

Slide 63

Slide 63 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 Comparable to nondeterministic! Nondeterministic This work Deterministic execution (STAMP trend)

Slide 64

Slide 64 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 < 2× slower than nondeterministic Nondeterministic This work Deterministic execution (STAMP trend)

Slide 65

Slide 65 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 Nondeterministic This work State of the art (DeSTM) Deterministic execution (STAMP trend)

Slide 66

Slide 66 text

Normalized execution time 0 1 2 3 4 5 Number of threads 2 4 8 16 Nondeterministic This work State of the art (DeSTM) ~3× better than state of the art! Deterministic execution (STAMP trend)

Slide 67

Slide 67 text

Evaluation Software transactional memory (see paper for + detail) • Slowdown of deterministic execution? • Is the fast execution mode faster? • Do transactions wait less? Hardware transactional memory (see paper) See for +details

Slide 68

Slide 68 text

Fast mode speedup × faster than standard execution 0 1 2 3 4 5 6 Number of accesses 0 1 2 4 8 16 32 64

Slide 69

Slide 69 text

× faster than standard execution 0 1 2 3 4 5 6 Number of accesses 0 1 2 4 8 16 32 64 50% reads, 50% writes Fast mode speedup

Slide 70

Slide 70 text

× faster than standard execution 0 1 2 3 4 5 6 Number of accesses 0 1 2 4 8 16 32 64 Pays off after 2 accesses 50% reads, 50% writes Fast mode speedup

Slide 71

Slide 71 text

Evaluation Software transactional memory (see paper for + detail) • Slowdown of deterministic execution? • Is the fast execution mode faster? • Do transactions wait less? Hardware transactional memory (see paper) See for +details

Slide 72

Slide 72 text

Waiting overhead (STAMP trend) Normalized time transactions waste waiting 0 1 2 3 4 Number of threads 2 4 8 16

Slide 73

Slide 73 text

This work Normalized time transactions waste waiting 0 1 2 3 4 Number of threads 2 4 8 16 Waiting overhead (STAMP trend)

Slide 74

Slide 74 text

Normalized time transactions waste waiting 0 1 2 3 4 Number of threads 2 4 8 16 This work State of the art (DeSTM) Waiting overhead (STAMP trend)

Slide 75

Slide 75 text

Determinism helps building reliable concurrent software Methodology applicable to both STM and HTM Fast mode: take advantage of deterministic order to minimise overheads <2× slower than nondeterministic
 ~3× better than state of the art Conclusion

Slide 76

Slide 76 text

Determinism helps building reliable concurrent software Methodology applicable to both STM and HTM Fast mode: take advantage of deterministic order to minimise overheads <2× slower than nondeterministic
 ~3× better than state of the art Thank you for your attention! Conclusion

Slide 77

Slide 77 text

Tiago Vale1 João Silva1 Ricardo Dias12 João Lourenço1 1NOVA LINCS / UNL 2SUSE Linux GmbH Deterministic transactional execution