1 / 43

Coarse-Grained Transactions

Coarse-Grained Transactions. Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson. Skew Heaps. Tree with “heap” property. 0. 1. 2. 3. 4. Concurrent Skew Heap. Insert me!. Insert me!. 6. 0. 2. 1. 3. 4. 5. Concurrent Skew Heap. 2. 6. 0.

jarvis
Télécharger la présentation

Coarse-Grained Transactions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Coarse-Grained Transactions Maurice Herlihy Brown University Joint work with Eric Koskinen and Matthew Parkinson

  2. Skew Heaps Tree with “heap” property 0 1 2 3 4 Dagstuhl Aug 2009

  3. Concurrent Skew Heap Insert me! Insert me! 6 0 2 1 3 4 5 Dagstuhl Aug 2009

  4. Concurrent Skew Heap 2 6 0 Lock parent Swap R & L 1 3 4 5 Dagstuhl Aug 2009

  5. Concurrent Skew Heap 2 6 0 Unlock parent 1 3 4 5 Lock right child Dagstuhl Aug 2009

  6. Concurrent Skew Heap No global rebalancing 6 0 1 3 Good amortized performance 4 5 2 Good concurrency Dagstuhl Aug 2009

  7. Transactional Skew Heap Insert me! Insert me! 6 0 2 1 3 4 5 Dagstuhl Aug 2009

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

  9. Coarse-Grained Synchronization 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 ofconflict? Dagstuhl Aug 2009

  10. Pessimistic Coarse-Grained Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  11. Pessimistic Coarse-Grained add(x) Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  12. Pessimistic Coarse-Grained add(x) Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  13. Pessimistic Coarse-Grained add(x) Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  14. Pessimistic Coarse-Grained add(x) rem(x) x Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  15. Pessimistic Coarse-Grained add(x) rem(x) add(y) x y Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  16. Pessimistic Coarse-Grained add(x) rem(x) member(x) x Undo Logs transactions Abstract locks Black-box linearizable data object Dagstuhl Aug 2009

  17. Pessimistic Coarse-Grained Thread-safe base object Log Inverses Updated in place Conflicting operations blocked by abstract locks What does it mean for operations to conflict? Dagstuhl Aug 2009

  18. Optimistic Coarse-Grained Black-box linearizable data object Dagstuhl Aug 2009

  19. Optimistic Coarse-Grained private copies Black-box linearizable data object Dagstuhl Aug 2009

  20. Optimistic Coarse-Grained redo logs private copies Black-box linearizable data object Dagstuhl Aug 2009

  21. Optimistic Coarse-Grained add(x) redo logs private copies Black-box linearizable data object Dagstuhl Aug 2009

  22. Optimistic Coarse-Grained add(x) redo logs add(x) private copies x Black-box linearizable data object Dagstuhl Aug 2009

  23. Optimistic Coarse-Grained add(y) add(x) redo logs add(x) add(y) private copies x y Black-box linearizable data object Dagstuhl Aug 2009

  24. On Commit redo logs add(x) add(y) add(x) private copies x y add(x) Black-box linearizable data object Dagstuhl Aug 2009

  25. No conflict, apply updates to my copy On Commit redo logs add(x) add(y) add(x) private copies x x y add(x) x Black-box linearizable data object Dagstuhl Aug 2009

  26. On Commit Different physical values, Same logical values add(x) add(y) add(x) x x y add(x) x Dagstuhl Aug 2009

  27. Conflict! Abort & restore my copy On Commit redo logs add(x) rem(x) add(x) private copies x add(x) x Black-box linearizable data object Dagstuhl Aug 2009

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

  29. time Left-Movers legal history Dagstuhl Aug 2009

  30. time Left-Movers If and are adjacent, Ok to move earlier Dagstuhl Aug 2009

  31. time Left-Mover Example: Semaphore dec() inc() dec() 1 0 1 0 Dagstuhl Aug 2009

  32. time Inc() is Left-mover WRT Dec() inc() dec() dec() 1 0 1 1 0 2 1 1 0 Dagstuhl Aug 2009

  33. time Left-Mover Example: Semaphore Same sequence of calls (results unaffected) inc() dec() dec() 1 0 1 1 0 2 1 1 0 Dagstuhl Aug 2009

  34. time Left-Mover Example: Semaphore inc() dec() dec() 3 3 2 3 2 4 3 3 2 Same final state Dagstuhl Aug 2009

  35. dec() inc() dec() time 0 1 0 Left-Mover CounterExample 1 Dagstuhl Aug 2009

  36. dec() inc() dec() time 0 1 0 Dec() not Left-Mover WRT Inc() -1 1 Dagstuhl Aug 2009

  37. time Right-Movers legal history Dagstuhl Aug 2009

  38. time Right-Movers If and are adjacent, Ok to move later Dagstuhl Aug 2009

  39. time Commutativity If and are adjacent, Ok to swap Dagstuhl Aug 2009

  40. Pessimistic needs Right-Movers • Right-Moverness ensures that aborting transaction’s operations can be ordered after the others’. • So we can apply inverses. • OK to proceed if operation is LM wrt other tentative operations. Dagstuhl Aug 2009

  41. Optimistic needs Left-Movers • Left-Moverness ensures that committing transaction’s operations can be ordered before the others’. • Abort self if concurrent transaction commits non-LM operation. Dagstuhl Aug 2009

  42. Summary • Identified link between • 2 basic concurrency control techniques • Algebraic properties of operations • Paper has • formal semantics, proofs … • Application to existing systems Dagstuhl Aug 2009

  43. Challenges • Automation? • Theorem proving • Model checking • Compiler & Language support? • Implementation … Dagstuhl Aug 2009

More Related