Presentation is loading. Please wait.

Presentation is loading. Please wait.

Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)

Similar presentations


Presentation on theme: "Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)"— Presentation transcript:

1 Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)

2 TMW April 2010 Skew Heaps 0 1 Tree with “heap” property 2 4 3

3 TMW April 2010 Concurrent Skew Heap 0 1 3 5 4 2 Insert me! 6

4 TMW April 2010 Concurrent Skew Heap 0 1 3 5 4 2 6 Lock parent Swap R & L

5 TMW April 2010 Concurrent Skew Heap 0 1 3 5 4 6 Lock right child Unlock parent 2

6 TMW April 2010 Concurrent Skew Heap 0 1 3 5 4 6 2 No global rebalancing Good amortized performance Good concurrency

7 TMW April 2010 Transactional Skew Heap 0 1 3 5 4 2 Insert me! 6

8 TMW April 2010 Transactional Skew Heap 0 1 3 5 4 2 6 I wrote 0 Write-write conflict! Good concurrency with locking Not with transactions … Confusion between thread-level & transaction-level synchronization Confusion between thread-level & transaction-level synchronization

9 TMW April 2010 Coarse-Grained Synchronization Synchronize on high-level operations, Like add(), remove(), etc. … Not low-level reads and writes Synchronize on high-level operations, Like add(), remove(), etc. … Not low-level reads and writes Pessimistic: update in place, undo on abort Optimistic: update private copy, apply changes on commit But what is the meaning of conflict?

10 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs

11 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs add(x)

12 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs add(x)

13 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object Undo Logs add(x)

14 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object rem(x) Undo Logs add(x) x

15 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object rem(x) Undo Logs add(x) x add(y) y

16 TMW April 2010 Pessimistic Boosting transactions Abstract locks Black-box linearizable data object rem(x) Undo Logs add(x) x member(x)

17 TMW April 2010 Pessimistic Boosting Thread-safe base object Updated in place Log Inverses Conflicting operations blocked by abstract locks What does it mean for operations to conflict?

18 TMW April 2010 Optimistic Boosting Black-box linearizable data object

19 TMW April 2010 Optimistic Boosting private copies Black-box linearizable data object

20 TMW April 2010 Optimistic Boosting redo logs private copies Black-box linearizable data object

21 TMW April 2010 Optimistic Boosting redo logs private copies Black-box linearizable data object add(x)

22 TMW April 2010 Optimistic Boosting add(x) redo logs private copies Black-box linearizable data object add(x) x

23 TMW April 2010 Optimistic Boosting add(x) add(y) redo logs private copies Black-box linearizable data object add(x) x add(y) y

24 TMW April 2010 On Commit add(x) add(y) redo logs private copies Black-box linearizable data object x y add(x)

25 TMW April 2010 On Commit add(x) add(y) redo logs private copies Black-box linearizable data object x y add(x) No conflict, apply updates to my copy x x

26 TMW April 2010 On Commit add(x) add(y) x y add(x) x x Different physical values, Same logical values

27 TMW April 2010 On Commit add(x) rem(x) redo logs private copies Black-box linearizable data object x add(x) Conflict! Abort & restore my copy x

28 TMW April 2010 Optimistic Boosting Thread-local object copies Deferred operatons kept in redo log No inverses On commit, broadcast deferred operations To other transactions, public copy On commit, broadcast deferred operations To other transactions, public copy Transactions snoop on broadcast, Abort if conflict detected Transactions snoop on broadcast, Abort if conflict detected What does it mean for operations to conflict?

29 TMW April 2010 Left-Movers time legal history

30 TMW April 2010 Left-Movers time If and are adjacent, Ok to move earlier

31 TMW April 2010 Left-Mover Example: Semaphore time inc()dec() 1 010

32 TMW April 2010 Inc() is Left-mover WRT Dec() time inc()dec() 1 100 102 1 1

33 TMW April 2010 Same sequence of calls (results unaffected) Left-Mover Example: Semaphore time inc()dec() 1 100 102 1 1

34 TMW April 2010 Same final state Left-Mover Example: Semaphore time inc()dec() 3 232 324 3 3

35 TMW April 2010 Left-Mover Counter-example time 1 dec() 0 inc() 1 dec() 0

36 TMW April 2010 Dec() not Left-Mover WRT Inc() time 1 dec() 0 inc() 1 dec() 0

37 TMW April 2010 Right-Movers time legal history

38 TMW April 2010 Right-Movers time If and are adjacent, Ok to move later

39 TMW April 2010 Commutativity time If and are adjacent, Ok to swap

40 What Theory? Sept 200940 Pessimistic Semantics (modify shared state in place) time Txn B beg Txn A beg Pessimistic Commit: Move Left of pending cmt

41 What Theory? Sept 200941 Pessimistic Semantics (modify shared state in place) time Txn B beg Txn A beg abt

42 What Theory? Sept 200942 Pessimistic Semantics (modify shared state in place) time 3 Txn B beg Txn A beg 1 2 4 Pessimistic Abort: Move Right of pending 2 4 3 1 Pessimistic Abort: Pending ops move Left

43 What Theory? Sept 200943 Pessimistic Semantics (modify shared state in place) Operations must be LEFT movers w.r.t. other pending operations On commit, move operations LEFT On abort, move operations RIGHT (free) and append inverses

44 What Theory? Sept 200944 Optimistic Semantics (modify local copies; merge) time Txn B Txn A beg Optimistic Commit: Move Right of committed cmt

45 What Theory? Sept 200945 Optimistic Semantics (modify local copies; merge) time Txn B Txn A beg Optimistic Abort: Discard Operations abt cmt

46 What Theory? Sept 200946 Operations must be RIGHT movers w.r.t. concurrently committed operations On commit, move operations RIGHT Abort if concurrent non-LM op On abort, discard local changes Optimistic Semantics (modify local copies; merge)

47 PessimisticOptimistic Two Execution Models What Theory? Sept 200947 Left-MovernessRight-Moverness Algebraic Abstract Properties

48 TMW April 2010 Challenges Automation? –Theorem proving –Model checking Compiler & Language support? Implementation …


Download ppt "Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson (POPL 10)"

Similar presentations


Ads by Google