fcsl previously on this channel previously on this channel
play

FCSL Previously on this channel Previously on this channel letrec - PowerPoint PPT Presentation

FCSL Previously on this channel Previously on this channel letrec span (x : ptr) : bool = { if x == null then val_ret false; else b CAS(x->m, 0, 1); if b then (r l ,r r ) (span(x->l) || span(x->r)); if r l then x->l :=


  1. FCSL

  2. Previously on this channel…

  3. Previously on this channel… letrec span (x : ptr) : bool = { if x == null then val_ret false; else b ← CAS(x->m, 0, 1); if b then (r l ,r r ) ← (span(x->l) || span(x->r)); if ¬r l then x->l := null; if ¬r r then x->r := null; val_ret true; else val_ret false; }

  4. Previously on this channel… letrec span (x : ptr) : bool = { if x == null then val_ret false; else b ← CAS(x->m, 0, 1); if b then (r l ,r r ) ← (span(x->l) || span(x->r)); if ¬r l then x->l := null; if ¬r r then x->r := null; val_ret true; else val_ret false; } a a a ✔ ✔ ✔ ✔ ✗ b c b c b c ✗ ✔ ✔ d e d e d e a a a ✔ ✔ ✔ ✔ ✗ b c b c b c ✗ ✔ ✔ d e d e d e

  5. Previously on this channel… Definition span_tp (x : ptr) := letrec span (x : ptr) : bool = { {i (g1 : graph (joint i))}, STsep [SpanTree] if x == null then val_ret false; ( fun s1 => i = s1 ⋀ (x == null ⋁ x ∈ dom (joint s1)), else b ← CAS(x->m, 0, 1); fun (r : bool) s2 => exists g2 : graph (joint s2), : if b then subgraph g1 g2 ⋀ (r l ,r r ) ← (span(x->l) || span(x->r)); if r then x != null ⋀ exists (t : set ptr), if ¬r l then x->l := null; self s2 = self i ⊕ t ⋀ if ¬r r then x->r := null; tree g2 x t ⋀ val_ret true; maximal g2 t ⋀ else val_ret false; front g1 t (self s2 ⊕ other s2) else (x == null ⋁ mark g2 x) ⋀ } self s2 = self i). a a a ✔ ✔ ✔ ✔ ✗ b c b c b c ✗ ✔ ✔ d e d e d e a a a ✔ ✔ ✔ ✔ ✗ b c b c b c ✗ ✔ ✔ d e d e d e

  6. Previously on this channel… Definition span_tp (x : ptr) := letrec span (x : ptr) : bool = { {i (g1 : graph (joint i))}, STsep [SpanTree] if x == null then val_ret false; ( fun s1 => i = s1 ⋀ (x == null ⋁ x ∈ dom (joint s1)), else b ← CAS(x->m, 0, 1); fun (r : bool) s2 => exists g2 : graph (joint s2), : if b then subgraph g1 g2 ⋀ (r l ,r r ) ← (span(x->l) || span(x->r)); if r then x != null ⋀ exists (t : set ptr), if ¬r l then x->l := null; self s2 = self i ⊕ t ⋀ if ¬r r then x->r := null; tree g2 x t ⋀ val_ret true; maximal g2 t ⋀ else val_ret false; front g1 t (self s2 ⊕ other s2) else (x == null ⋁ mark g2 x) ⋀ } self s2 = self i). a | {z } a a ✔ ✔ + with {} ✔ ✔ ✗ b c b c b c tree g2 a t ⋀ maximal g2 t ⋀ ✗ ✔ ✔ front g1 t (self s2) ⋀ t = self s2 ⋀ d e d e d e is_root a g1 ⋀ subgraph g1 g2 a a a ✔ ✔ ✔ ✔ ✗ b c b c b c ✗ ✔ ✔ d e d e d e

  7. Previously on this channel… Definition span_tp (x : ptr) := letrec span (x : ptr) : bool = { {i (g1 : graph (joint i))}, STsep [SpanTree] if x == null then val_ret false; ( fun s1 => i = s1 ⋀ (x == null ⋁ x ∈ dom (joint s1)), else b ← CAS(x->m, 0, 1); fun (r : bool) s2 => exists g2 : graph (joint s2), : if b then subgraph g1 g2 ⋀ (r l ,r r ) ← (span(x->l) || span(x->r)); if r then x != null ⋀ exists (t : set ptr), if ¬r l then x->l := null; self s2 = self i ⊕ t ⋀ if ¬r r then x->r := null; tree g2 x t ⋀ val_ret true; maximal g2 t ⋀ else val_ret false; front g1 t (self s2 ⊕ other s2) else (x == null ⋁ mark g2 x) ⋀ } self s2 = self i). a | {z } a a ✔ ✔ + with {} ✔ ✔ ✗ b c b c b c tree g2 a t ⋀ maximal g2 t ⋀ ✗ ✔ ✔ front g1 t (self s2) ⋀ t = self s2 ⋀ d e d e d e is_root a g1 ⋀ subgraph g1 g2 ⇓ a a a ✔ ✔ ✔ ✔ ✗ spanning t g1 b c b c b c ✗ ✔ ✔ d e d e d e

  8. Previously on this channel… Definition span_tp (x : ptr) := letrec span (x : ptr) : bool = { {i (g1 : graph (joint i))}, STsep [SpanTree] if x == null then val_ret false; ( fun s1 => i = s1 ⋀ (x == null ⋁ x ∈ dom (joint s1)), else b ← CAS(x->m, 0, 1); fun (r : bool) s2 => exists g2 : graph (joint s2), : if b then subgraph g1 g2 ⋀ (r l ,r r ) ← (span(x->l) || span(x->r)); if r then x != null ⋀ exists (t : set ptr), if ¬r l then x->l := null; self s2 = self i ⊕ t ⋀ if ¬r r then x->r := null; tree g2 x t ⋀ val_ret true; maximal g2 t ⋀ else val_ret false; front g1 t (self s2 ⊕ other s2) else (x == null ⋁ mark g2 x) ⋀ } self s2 = self i). a | {z } a a ✔ ✔ + with {} ✔ ✔ ✗ b c b c b c tree g2 a t ⋀ maximal g2 t ⋀ ✗ ✔ ✔ front g1 t (self s2) ⋀ t = self s2 ⋀ d e d e d e is_root a g1 ⋀ subgraph g1 g2 ⇓ a a a ✔ ✔ ✔ ✔ ✗ spanning t g1 b c b c b c ✗ ✔ ✔ d e d e d e

  9. Previously on this channel… Definition span_tp (x : ptr) := letrec span (x : ptr) : bool = { {i (g1 : graph (joint i))}, STsep [SpanTree] if x == null then val_ret false; ( fun s1 => i = s1 ⋀ (x == null ⋁ x ∈ dom (joint s1)), else b ← CAS(x->m, 0, 1); fun (r : bool) s2 => exists g2 : graph (joint s2), : if b then subgraph g1 g2 ⋀ (r l ,r r ) ← (span(x->l) || span(x->r)); if r then x != null ⋀ exists (t : set ptr), if ¬r l then x->l := null; self s2 = self i ⊕ t ⋀ if ¬r r then x->r := null; tree g2 x t ⋀ val_ret true; maximal g2 t ⋀ else val_ret false; front g1 t (self s2 ⊕ other s2) else (x == null ⋁ mark g2 x) ⋀ } self s2 = self i). a | {z } a a ✔ ✔ + with {} ✔ ✔ ✗ b c b c b c tree g2 a t ⋀ maximal g2 t ⋀ ✗ ✔ ✔ front g1 t (self s2) ⋀ t = self s2 ⋀ d e d e d e is_root a g1 ⋀ subgraph g1 g2 ⇓ a a a ✔ ✔ ✔ ✔ ✗ spanning t g1 b c b c b c ✗ ✔ ✔ d e d e d e

  10. Anatomy of mechanized reasoning 
 about fine-grained 
 concurrency Ilya Sergey joint work with 
 Aleks Nanevski Anindya Banerjee Ruy Ley-Wild Germán Delbianco

  11. Concurrent Hoare-style specifications

  12. Concurrent Hoare-style specifications { P } { Q } c

  13. Concurrent Hoare-style specifications { P } { Q } c C ⊢

  14. Concurrent Hoare-style specifications Context that specifies expected 
 thread interference { P } { Q } c C ⊢

  15. Concurrent Hoare-style specifications Context that specifies expected 
 thread interference { P } { Q } c C ⊢ aka. rely/guarantee, concurrent resources, regions, protocols, islands, invariants, concurroids, monitors

  16. Owicki-Gries (1976) Rely-Guarantee (1983) CSL (2004) Bornat-al (2005) RGSep (2007) SAGL (2007) Gotsman-al (2007) Deny-Guarantee (2009) LRG (2009) CAP (2010) Jacobs-Piessens (2011) HLRG (2010) HOCAP (2013) RGSim (2012) SCSL (2013) Liang-Feng (2013) iCAP (2014) TaDA (2014) CaReSL (2013) CoLoSL (2015) FCSL (2014) Iris (2015)

  17. Owicki-Gries (1976) Rely-Guarantee (1983) CSL (2004) Bornat-al (2005) RGSep (2007) SAGL (2007) Gotsman-al (2007) Deny-Guarantee (2009) LRG (2009) CAP (2010) Jacobs-Piessens (2011) HLRG (2010) HOCAP (2013) RGSim (2012) SCSL (2013) Liang-Feng (2013) iCAP (2014) TaDA (2014) CaReSL (2013) CoLoSL (2015) FCSL (2014) Iris (2015)

  18. Owicki-Gries (1976) Rely-Guarantee (1983) CSL (2004) Bornat-al (2005) RGSep (2007) SAGL (2007) Gotsman-al (2007) Deny-Guarantee (2009) LRG (2009) CAP (2010) Jacobs-Piessens (2011) HLRG (2010) HOCAP (2013) RGSim (2012) SCSL (2013) Liang-Feng (2013) iCAP (2014) TaDA (2014) CaReSL (2013) CoLoSL (2015) FCSL (2014) Iris (2015)

  19. FCSL: Fine-grained Concurrent Separation Logic Nanevski, Ley-Wild, Sergey, Delbianco [ESOP’14]

  20. FCSL: Fine-grained Concurrent Separation Logic Nanevski, Ley-Wild, Sergey, Delbianco [ESOP’14] • Logic for reasoning with concurroids

  21. FCSL: Fine-grained Concurrent Separation Logic Nanevski, Ley-Wild, Sergey, Delbianco [ESOP’14] • Logic for reasoning with concurroids • Emphasis on subjective specifications

  22. Agenda • Defining concurroids • Atomic actions and stable specifications • Verification layout

  23. Agenda • Defining concurroids • Atomic actions and stable specifications • Verification layout

  24. Concurroids • State-transition systems with subjective state • Coherence predicate defines resource state-space

  25. Demo 1: Definition of a concurroid’s 
 coherence predicate

  26. Concurroids

  27. Concurroids • State-transition systems with subjective state • Coherence predicate defines resource state-space

  28. Concurroids • State-transition systems with subjective state • Coherence predicate defines resource state-space • Transitions describe guarantee (and rely by transposition)

  29. mark-node transition A successful attempt to atomically mark a node and add it to self

  30. mark-node transition A successful attempt to atomically mark a node and add it to self a b c d e

  31. mark-node transition A successful attempt to atomically mark a node and add it to self a a ✔ → b c b c d e d e

  32. nullify-edge transition Atomically pruning of an edge from a node, owned in self

  33. nullify-edge transition Atomically pruning of an edge from a node, owned in self a ✔ ✔ b c ✗ ✔ d e

  34. nullify-edge transition Atomically pruning of an edge from a node, owned in self a a ✔ ✔ ✔ ✔ → b c b c ✗ ✔ ✔ d e d e

  35. Demo 2: Defining concurroid transitions

  36. Agenda • Defining concurroids • Atomic actions and stable specifications • Verification layout

  37. Agenda • Defining concurroids • Atomic actions and stable specifications • Verification layout

Recommend


More recommend