exploiting the commutativity lattice
play

Exploiting the Commutativity Lattice Donald Nguyen, Dimitrios - PowerPoint PPT Presentation

Exploiting the Commutativity Lattice Donald Nguyen, Dimitrios Milind Kulkarni Prountzos, Xin Sui and Keshav Pingali Wednesday, July 20, 2011 Exploiting semantics in transactional execution Set S: X Y Z 2 Wednesday, July 20, 2011


  1. ฀ Exploiting the Commutativity Lattice Donald Nguyen, Dimitrios Milind Kulkarni Prountzos, Xin Sui and Keshav Pingali Wednesday, July 20, 2011

  2. Exploiting semantics in transactional execution Set S: X Y Z 2 Wednesday, July 20, 2011

  3. Exploiting semantics in transactional execution Set S: X Y Z atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 2 Wednesday, July 20, 2011

  4. Exploiting semantics in transactional execution Set S: X X Y Y Z Z A atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 2 Wednesday, July 20, 2011

  5. Exploiting semantics in transactional execution Set S: X X Y Y Z Z A X atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 2 Wednesday, July 20, 2011

  6. Exploiting semantics in transactional execution Set S: X X Y Y Z Z A atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 2 Wednesday, July 20, 2011

  7. Exploiting semantics in transactional execution Set S: X X Y Y Z Z A atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 2 Wednesday, July 20, 2011

  8. Exploiting semantics in transactional execution Set S: X Y Z A atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 3 Wednesday, July 20, 2011

  9. Exploiting semantics in transactional execution Set S: X Y Z A Key insight: exploit commutativity properties to ensure transactional behavior atomic { atomic { ... ... S.add(a) S.contains(b) ... ... } } 3 Wednesday, July 20, 2011

  10. Exploiting semantics in transactional execution [Carlstrom et al. [Koskinen et al. PPoPP 07] Set S: X Y Z A POPL 10] [Weihl et al. IEEE Key insight: exploit commutativity properties ToC 88] [Ni et al. PPoPP 07] to ensure transactional behavior atomic { atomic { ... ... [Herlihy & Koskinen [Kulkarni et al. S.add(a) S.contains(b) PPoPP 08] PLDI 07] ... ... } } [Kulkarni et al. ASPLOS 08] 3 Wednesday, July 20, 2011

  11. How do we check commutativity? • Can specify conditions for commutativity: add(a)/r commutes with contains(b)/r if a ≠ b • How should a transactional run-time system check these? • Prior work: ad hoc combinations of logging and locking 4 Wednesday, July 20, 2011

  12. How do we check commutativity? add(a)/r commutes with contains(b)/r if a ≠ b 5 Wednesday, July 20, 2011

  13. How do we check commutativity? add(a)/r commutes with contains(b)/r if a ≠ b or r = false 5 Wednesday, July 20, 2011

  14. How do we check commutativity? • Commutativity can be more complex: add(a)/r commutes with contains(b)/r if a ≠ b or r = false • Prior work often did not fully check commutativity to reduce overhead • How do we know this is correct? 5 Wednesday, July 20, 2011

  15. Contributions • Define a commutativity lattice for reasoning about commutativity specifications • How do we check commutativity? • Provide systematic approaches for implementing commutativity checks • How do we implement low overhead checks? • Show how to use commutativity lattice to correctly construct lower-overhead checkers 6 Wednesday, July 20, 2011

  16. Commutativity σ 1 7 Wednesday, July 20, 2011

  17. Commutativity σ 1 m 1 r 1 7 Wednesday, July 20, 2011

  18. Commutativity σ 1 σ 2 m 1 r 1 7 Wednesday, July 20, 2011

  19. Commutativity σ 1 σ 2 m 1 m 2 r 1 r 2 7 Wednesday, July 20, 2011

  20. Commutativity σ 1 σ 2 σ 3 m 1 m 2 r 1 r 2 7 Wednesday, July 20, 2011

  21. Commutativity σ 1 σ 2 σ 3 m 1 m 2 r 1 r 2 m 1, m 2 commute in σ 1 7 Wednesday, July 20, 2011

  22. Commutativity σ 1 σ ’ 2 σ 3 m 2 m 1 r 2 r 1 m 1, m 2 commute in σ 1 8 Wednesday, July 20, 2011

  23. Using commutativity to guarantee serializability A : m 1 m 2 m 3 m 4 B : m 1 m 2 m 3 m 4 9 Wednesday, July 20, 2011

  24. Using commutativity to guarantee serializability History : m 1 m 1 m 2 m 2 m 3 m 3 m 4 m 4 10 Wednesday, July 20, 2011

  25. Using commutativity to guarantee serializability σ 1 σ 2 σ 3 σ 4 σ 5 σ 6 σ 7 σ 8 σ 9 History : m 1 m 1 m 2 m 2 m 3 m 3 m 4 m 4 10 Wednesday, July 20, 2011

  26. Using commutativity to guarantee serializability σ 1 σ 2 σ 3 σ ’ 4 σ 5 σ 6 σ 7 σ 8 σ 9 History : m 1 m 1 m 2 m 2 m 3 m 3 m 4 m 4 11 Wednesday, July 20, 2011

  27. Using commutativity to guarantee serializability σ 1 σ 2 σ ’ 3 σ ’ 4 σ 5 σ 6 σ 7 σ 8 σ 9 History : m 1 m 2 m 1 m 2 m 3 m 3 m 4 m 4 12 Wednesday, July 20, 2011

  28. Using commutativity to guarantee serializability σ 1 σ 2 σ ’ 3 σ ” 4 σ ’ 5 σ ’ 6 σ ’ 7 σ 8 σ 9 History : m 1 m 2 m 3 m 4 m 1 m 2 m 3 m 4 13 Wednesday, July 20, 2011

  29. Runtime commutativity checks • For each method invocation by transaction B • Runtime checks commutativity with all methods invoked by transaction A • If all checks succeed, execution continues • If any commutativity check fails, one transaction rolled back 14 Wednesday, July 20, 2011

  30. Commutativity conditions φ (m a, m b ) Commutativity condition: 15 Wednesday, July 20, 2011

  31. Commutativity conditions φ (m a, m b ) Commutativity condition: true only if m a and m b commute 15 Wednesday, July 20, 2011

  32. Commutativity conditions φ (m a, m b ) Commutativity condition: * φ (m a, m b ) Precise condition: 15 Wednesday, July 20, 2011

  33. Commutativity conditions φ (m a, m b ) Commutativity condition: * φ (m a, m b ) Precise condition: true if and only if m a and m b commute 15 Wednesday, July 20, 2011

  34. Commutativity conditions φ (m a, m b ) Commutativity condition: * φ (m a, m b ) Precise condition: * φ ( add(a)/r 1 , contains(b)/r 2 ) a ≠ b or r 1 = false 15 Wednesday, July 20, 2011

  35. Commutativity lattice ( add(a)/r 1 , contains(b)/r 2 ) a ≠ b or r 1 = false 16 Wednesday, July 20, 2011

  36. Commutativity lattice ( add(a)/r 1 , contains(b)/r 2 ) a ≠ b or r 1 = false a ≠ b r 1 = false false 16 Wednesday, July 20, 2011

  37. Commutativity lattice ( add(a)/r 1 , contains(b)/r 2 ) Allows most a ≠ b or r 1 = false parallelism a ≠ b r 1 = false Allows no false parallelism 16 Wednesday, July 20, 2011

  38. Implementing Commutativity Wednesday, July 20, 2011

  39. Soundness and completeness • A conflict detection implementation is sound if it claims methods commute only if they actually do according to the conditions • A conflict detection implementation is complete if it claims methods commute if they do according to the conditions 18 Wednesday, July 20, 2011

  40. Running example • Set-like data structure • Supports add and contains ( add(a)/r 1 , contains(b)/r 2 ) a ≠ b or r 1 = false ( add(a)/r 1 , add(b)/r 2 ) a ≠ b or (r 1 = false and r 2 = false ) ( contains(a)/r 1 , contains(b)/r 2 ) true 19 Wednesday, July 20, 2011

  41. Running example • Set-like data structure • Supports add and contains ( add(a)/r 1 , contains(b)/r 2 ) a ≠ b ( add(a)/r 1 , add(b)/r 2 ) a ≠ b ( contains(a)/r 1 , contains(b)/r 2 ) true 20 Wednesday, July 20, 2011

  42. Implementing commutativity • Three schemes • Abstract locking • Forward gatekeeping • General gatekeeping 21 Wednesday, July 20, 2011

  43. Abstract locking • Sound and complete implementation when commutativity condition is simple • Is either true , false , or a set of conjuncts of the form “x ≠ y” ( add(a)/r 1 , contains(b)/r 2 ) a ≠ b or r 1 = false Not simple: a ≠ b Simple: 22 Wednesday, July 20, 2011

  44. Abstract locking • Basic skeleton • Associate an abstract lock with each object that can be passed as an argument to a method • When a method is called, acquire locks on each argument in appropriate mode • Object already locked → commutativity violation • All locks released when transaction ends • Key problem: building compatibility matrix 23 Wednesday, July 20, 2011

  45. Building compatibility matrix • One mode per argument of a method add(a) → add:1 contains(b) → cont:1 24 Wednesday, July 20, 2011

  46. Building compatibility matrix • One mode per argument of a method add(a) → add:1 contains(b) → cont:1 cont:1 add:1 cont:1 add:1 24 Wednesday, July 20, 2011

  47. Building compatibility matrix • Compatibility: If condition includes conjunct “a ≠ b” then modes for a and b incompatible φ ( add(a)/r 1 , contains(b)/r 2 ) : a ≠ b cont:1 add:1 cont:1 add:1 25 Wednesday, July 20, 2011

  48. Building compatibility matrix • Compatibility: If condition includes conjunct “a ≠ b” then modes for a and b incompatible φ ( add(a)/r 1 , contains(b)/r 2 ) : a ≠ b cont:1 add:1 cont:1 add:1 25 Wednesday, July 20, 2011

  49. Building compatibility matrix • Compatibility: modes for a and b incompatible if condition includes conjunct “a ≠ b” φ ( add(a)/r 1 , add(b)/r 2 ) : a ≠ b cont:1 add:1 cont:1 add:1 26 Wednesday, July 20, 2011

  50. Building compatibility matrix • Compatibility: modes for a and b incompatible if condition includes conjunct “a ≠ b” φ ( add(a)/r 1 , add(b)/r 2 ) : a ≠ b cont:1 add:1 cont:1 add:1 26 Wednesday, July 20, 2011

  51. Building the compatibility matrix • Compatibility: modes for a and b incompatible if condition includes conjunct “a ≠ b” φ ( contains(a)/r 1 , contains(b)/r 2 ) : true cont:1 add:1 cont:1 add:1 27 Wednesday, July 20, 2011

Recommend


More recommend