Coarse-Grained Transactions Eric Koskinen University of Cambridge 20 January 2010 Joint work with Matthew Parkinson, Maurice Herlihy Wednesday, 20 January 2010
Abstract Data Types global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } Wednesday, 20 January 2010
Abstract Data Types ADT Operations global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } Wednesday, 20 January 2010
Abstract Data Types ADT Operations global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } T1 (Add3) (Rm5) T2 (Has6) (Rm7) Wednesday, 20 January 2010
Abstract Data Types ADT Operations global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) Wednesday, 20 January 2010
Abstract Data Types ADT Operations global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } Abort! T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) Wednesday, 20 January 2010
Abstract Data Types ADT Operations global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } Abort! T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types ADT Operations global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } Abort! T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Abort! Wednesday, 20 January 2010
Abstract Data Types • Low-level synchronization (r/w conflicts) impairs performance • So how can operations be synchronized? Wednesday, 20 January 2010
what if skiplist is linearizable? Wednesday, 20 January 2010
Abstract Data Types global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types global SkipList set; atomic { atomic { set.Add(3); if set.Has(6) then set.Rm(5) set.Rm(7) } } T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Equiv. Serial History T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types • Abstract data types ... Wednesday, 20 January 2010
Abstract Data Types • Abstract data types ... • ... require abstract synchronization: Wednesday, 20 January 2010
Abstract Data Types • Abstract data types ... • ... require abstract synchronization: • ... based on method “movement” Wednesday, 20 January 2010
Abstract Data Types • Abstract data types ... • ... require abstract synchronization: • ... based on method “movement” • Left Movers, Right Movers, Both Movers Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) set.Rm(5) set.Has(6) T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) ⊳ set.Rm(5) set.Has(6) T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) ⊲ set.Rm(5) set.Has(6) T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) ⊲ ⊳ set.Rm(5) set.Has(6) T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) ⊲ ⊳ set.Rm(5) set.Has(6) ⊲ ⊳ T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) ⊲ ⊳ set.Rm(5) set.Has(6) ⊲ ⊳ set.*(x) set.*(y) ⊲ ⊳ T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Abstract Data Types set.Rm(5) set.Rm(7) ⊲ ⊳ set.Rm(5) set.Has(6) ⊲ ⊳ if x ≠ y set.*(x) set.*(y) ⊲ ⊳ T1 (Add3) (Rm5) (cmt) T2 (Has6) (Rm7) (cmt) Wednesday, 20 January 2010
Left-movers o.m ⊳ p.n iff Wednesday, 20 January 2010
Left-movers o.m ⊳ p.n iff { σ ′′ | ∃ σ ′ .σ → σ ′ ∧ σ ′ p.n o.m − − − − → σ ′′ } ⊆ ∀ σ { σ ′′′ | ∃ σ ′ .σ → σ ′ ∧ σ ′ p.n o.m − − − − → σ ′′′ } Wednesday, 20 January 2010
Left-movers o.m ⊳ p.n iff { σ ′′ | ∃ σ ′ .σ → σ ′ ∧ σ ′ p.n o.m − − − − → σ ′′ } ⊆ ∀ σ { σ ′′′ | ∃ σ ′ .σ → σ ′ ∧ σ ′ p.n o.m − − − − → σ ′′′ } Similar for Right-movers Wednesday, 20 January 2010
Left-movers dec() inc() dec() 1 0 1 0 time Wednesday, 20 January 2010
Left-movers inc() dec() dec() 1 0 1 11 0 2 1 0 time What Theory? Sept 2009 10 Wednesday, 20 January 2010
Left-movers Valid sequence of calls (same return values) inc() dec() dec() 1 0 1 11 0 2 1 0 time What Theory? Sept 2009 11 Wednesday, 20 January 2010
Left-movers inc() dec() dec() 1 0 1 11 0 2 1 0 time Same final state What Theory? Sept 2009 12 Wednesday, 20 January 2010
Left-movers inc() dec() dec() 1 0 1 11 0 2 1 0 time Same final state inc() dec() What Theory? Sept 2009 12 Wednesday, 20 January 2010
Left-movers inc() dec() dec() 1 0 1 11 0 2 1 0 time Same final state inc() dec() ⊳ What Theory? Sept 2009 12 Wednesday, 20 January 2010
Left-movers dec() inc() dec() 1 0 1 0 time What Theory? Sept 2009 13 Wednesday, 20 January 2010
Left-movers dec() inc() dec() -1 1 0 1 0 time What Theory? Sept 2009 14 Wednesday, 20 January 2010
Left-movers dec() inc() dec() -1 1 0 1 0 time dec() is NOT a left mover w.r.t inc() What Theory? Sept 2009 14 Wednesday, 20 January 2010
Right-movers time If and are adjacent, Ok to move later Wednesday, 20 January 2010
Right-movers Both-movers time time If and are adjacent, If and are adjacent, Ok to move later Ok to swap Wednesday, 20 January 2010
Syntax ::= c ; s | beg t ; s | skip s ::= c ; t | x := o.m ( a ); t | end t Wednesday, 20 January 2010
Atomic Semantics C a = T, σ where T : list s Wednesday, 20 January 2010
Atomic Semantics C a = T, σ where T : list s → A s ′ , σ ′ s, σ − → A T 1 :: s ′ :: T 2 , σ ′ T 1 :: s :: T 2 , σ − Wednesday, 20 January 2010
Atomic Semantics C a = T, σ where T : list s → A s ′ , σ ′ s, σ − → A T 1 :: s ′ :: T 2 , σ ′ T 1 :: s :: T 2 , σ − Statements σ ′ ∈ � c � σ → A s, σ ′ c ; s, σ − t, σ ⇓ A σ ′ → A s, σ ′ beg t ; s, σ − Wednesday, 20 January 2010
Atomic Semantics C a = T, σ where T : list s → A s ′ , σ ′ s, σ − → A T 1 :: s ′ :: T 2 , σ ′ T 1 :: s :: T 2 , σ − Statements Transactions σ ′′ ∈ � o.m ( a ) � σ t, σ ′′ ⇓ A σ ′ σ ′ ∈ � c � σ → A s, σ ′ o.m ( a ); t, σ ⇓ A σ ′ c ; s, σ − t, σ ⇓ A σ ′ end , σ ⇓ A σ → A s, σ ′ beg t ; s, σ − Wednesday, 20 January 2010
Theorem. The atomic semantics Atomic Semantics produce serial histories. C a = T, σ where T : list s → A s ′ , σ ′ s, σ − → A T 1 :: s ′ :: T 2 , σ ′ T 1 :: s :: T 2 , σ − Statements Transactions σ ′′ ∈ � o.m ( a ) � σ t, σ ′′ ⇓ A σ ′ σ ′ ∈ � c � σ → A s, σ ′ o.m ( a ); t, σ ⇓ A σ ′ c ; s, σ − t, σ ⇓ A σ ′ end , σ ⇓ A σ → A s, σ ′ beg t ; s, σ − Wednesday, 20 January 2010
Implementation Strategies Wednesday, 20 January 2010
Implementation Strategies Pessimistic Optimistic undos undos undos T 1 T 2 T 3 T 1 T 2 T 3 add(2) rm(4) add(4) redos redos redos merge merge Boosting, Open Nested Txns, Lock Inf. RW STM, Intel, TL2, Burkhardt Wednesday, 20 January 2010
Implementation Strategies Pessimistic Optimistic undos undos undos T 1 T 2 T 3 T 1 T 2 T 3 add(2) rm(4) add(4) Abort! redos redos redos merge merge Boosting, Open Nested Txns, Lock Inf. RW STM, Intel, TL2, Burkhardt Wednesday, 20 January 2010
Implementation Strategies Pessimistic Optimistic C opt = T, σ sh , ℓ sh C p = T, σ T i : N ⊥ × s × list M T i : N ⊥ × s × σ × σ × ℓ τ Wednesday, 20 January 2010
Implementation Strategies Pessimistic Optimistic C opt = T, σ sh , ℓ sh C p = T, σ T i : N ⊥ × s × list M T i : N ⊥ × s × σ × σ × ℓ τ transaction identifier code oustanding ops Wednesday, 20 January 2010
Implementation Strategies Pessimistic Optimistic C opt = T, σ sh , ℓ sh C p = T, σ T i : N ⊥ × s × list M T i : N ⊥ × s × σ × σ × ℓ τ transaction identifier thread-local state previous state code replay log oustanding ops Wednesday, 20 January 2010
Recommend
More recommend