Janus exploiting parallelism via hindsight Omer Tripp John


















































































































![parallelization protocol shared state [k] b 1 b 2. . . bm privatized state parallelization protocol shared state [k] b 1 b 2. . . bm privatized state](https://slidetodoc.com/presentation_image_h/02361b06ea04254a033c23303d6b2f92/image-115.jpg)
![parallelization protocol shared state [k] b 1 b 2. . . bm privatized state parallelization protocol shared state [k] b 1 b 2. . . bm privatized state](https://slidetodoc.com/presentation_image_h/02361b06ea04254a033c23303d6b2f92/image-116.jpg)
![parallelization protocol shared state [k] privatized state [k] shared state [k+1] privatized state [k’] parallelization protocol shared state [k] privatized state [k] shared state [k+1] privatized state [k’]](https://slidetodoc.com/presentation_image_h/02361b06ea04254a033c23303d6b2f92/image-117.jpg)
![parallelization protocol shared state [k] b 1 b 2. . . bm privatized state parallelization protocol shared state [k] b 1 b 2. . . bm privatized state](https://slidetodoc.com/presentation_image_h/02361b06ea04254a033c23303d6b2f92/image-118.jpg)
![parallelization protocol shared state [k] retry privatized state [k+2] shared state [k+1] shared state parallelization protocol shared state [k] retry privatized state [k+2] shared state [k+1] shared state](https://slidetodoc.com/presentation_image_h/02361b06ea04254a033c23303d6b2f92/image-119.jpg)





















- Slides: 140
Janus: exploiting parallelism via hindsight Omer Tripp John Field Roman Manevich Mooly Sagiv
the PMD code analyzer
the PMD code analyzer popular open-source code analyzer (~2, 000 weekly downloads)
the PMD code analyzer popular open-source code analyzer (~2, 000 weekly downloads) scans source files modularly => parallelization opportunity
the main loop of PMD (simplified)
the main loop of PMD analyze files in parallel
the main loop of PMD but. . (shared as local)
the main loop of PMD hmm. . can’t we “localize” ctx?
the main loop of PMD not so fast. . (happens sometimes, deep down the stack)
the main loop of PMD no cloning =>
the main loop of PMD reuse => @atomic ≈ @sequential
the main loop of PMD to summarize. .
the main loop of PMD to summarize. . available parallelism
the main loop of PMD to summarize. . available parallelism missed by write-set approach
Janus: Janus sequence-based detection / * e n i l /* off
Janus: Janus sequence-based detection / * e n i l /* off T 1 T 2 ctx. source. Code. Filename = …; … String fname=ctx. source. Code. Filename; …
Janus: Janus sequence-based detection / * e n i l /* off T 1 T 2 ctx. source. Code. Filename = …; … String fname=ctx. source. Code. Filename; …
Janus: Janus sequence-based detection / * e n i l /* off T 1 T 2 ctx. source. Code. Filename = …; … ctx. set. Attribute(s, …); … ctx. source. Code. Filename = …; … … = ctx. get. Attribute(s); …
Janus: Janus sequence-based detection / * e n i l /* off T 1 T 2 ctx. source. Code. Filename = …; … ctx. set. Attribute(s, …); … ctx. source. Code. Filename = …; … … = ctx. get. Attribute(s); …
Janus: Janus sequence-based detection / * e n i l /* off T 1 T 2 ctx. source. Code. Filename = …; … ctx. set. Attribute(s, …); … ctx. source. Code. Filename = …; … … = ctx. get. Attribute(s); …
the main loop of PMD in paper: • more real-world examples • more coding patterns encouraging refined conflict detection
running example Reverse-Delete MST G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() for i=1 … n G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
running example ordered Reverse-Delete MST G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() for i=1 … n G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
running example heavy Reverse-Delete MST G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() for i=1 … n G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
running example identity if edge restored (available parallelism) Reverse-Delete MST G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() for i=1 … n G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
take I: blind parallelism Reverse-Delete MST G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() for parallel for i=1 … n // broken but fast G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
take II: write-set speculation / * g n i t os o b h t i /* w Reverse-Delete MST G’ = G (e 1 … en)= Sort. Edges. By. Decreasing. Weight() for i=1 … n @atomic // exploit graph semantics: node ≈ location G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
take II: write-set speculation / * g n i t os o b h t i /* w can we exploit the available parallelism with this approach?
the write-set approach in action G: T 1 v 1 u v 2 T 2
the write-set approach in action G: T 1 Remove. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2)
the write-set approach in action G: T 1 Remove. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2)
the write-set approach in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2)
the write-set approach in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2)
the write-set approach in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b
the write-set approach in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
the write-set approach in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
take III: online commutativity checking / * g n i t os o b h t i /* w Reverse-Delete MST G’ = G (e 1 … en)= Sort. Edges. By. Decreasing. Weight() for i=1 … n @atomic // full commutativity checking G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
precise checking in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
precise checking in action G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
precise checking in action G: v 1 u T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) Remove. Edge(u, v 1); Has. Path(u, v 1); Add. Edge(u, v 1) Remove. Edge(u, v 2); Has. Path(u, v 2); Add. Edge(u, v 2) v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) ∙ ≡ ∙ Remove. Edge(u, v 2); Has. Path(u, v 2); Add. Edge(u, v 2) Remove. Edge(u, v 1); Has. Path(u, v 1); Add. Edge(u, v 1)
precise checking in action G: v 1 u T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) Remove. Edge(u, v 1); Has. Path(u, v 1); Add. Edge(u, v 1) Remove. Edge(u, v 2); Has. Path(u, v 2); Add. Edge(u, v 2) v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) ∙ ≡ ∙ Remove. Edge(u, v 2); Has. Path(u, v 2); Add. Edge(u, v 2) Remove. Edge(u, v 1); Has. Path(u, v 1); Add. Edge(u, v 1)
but. . can we really afford this? G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
but. . can we really afford this? G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) expensive instrumentation
but. . can we really afford this? G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) + v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) expensive instrumentation
but. . can we really afford this? G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) + v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) expensive instrumentation expensive conflict detection
but. . can we really afford this? G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) + v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) expensive instrumentation expensive conflict detection
but. . can we really afford this? G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) + v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) expensive instrumentation expensive conflict detection poor performance
take III: Janus / * g n i t os o b h t i /* w Reverse-Delete MST G’ = G (e 1 … en)= Sort. Edges. By. Decreasing. Weight() for i=1 … n @atomic // accurate checking utilizing offline data! G’. Remove. Edge(ei) if (!G’. Has. Path(ei. u, ei. v)) G’. Add. Edge(ei) return G’
the Janus approach G: T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) v 1 u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
the Janus approach G: v 1 T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) sequence-based detection u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2)
the Janus approach G: v 1 T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) sequence-based detection u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) => accurate
the Janus approach G: v 1 T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) sequence-based detection candidate sequences learned ahead of production runs, in profiling => accurate
the Janus approach G: v 1 T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) sequence-based detection candidate sequences learned ahead of production runs, in profiling commutativity testing done offline => accurate
the Janus approach G: v 1 T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) u v 2 T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) sequence-based detection candidate sequences gleaned ahead of production runs, in profiling commutativity testing done offline => accurate => cheap
the Janus flow offline
the Janus flow find candidate sequences via profiling *ST runs *single locations offline
the Janus flow find candidate sequences via profiling *ST runs *single locations offline low instrumentation overhead
the Janus flow find candidate sequences via profiling *ST runs *single locations offline test sequences for commutativity
the Janus flow find candidate sequences via profiling *ST runs *single locations offline test sequences for commutativity cache (generalized version) of commutative sequences
the Janus flow find candidate sequences via profiling *ST runs *single locations test sequences for commutativity offline cheap conflict detection cache (generalized version) of commutative sequences
the Janus flow find candidate sequences via profiling *ST runs *single locations offline test sequences for commutativity cache (generalized version) of commutative sequences
the Janus flow find candidate sequences via profiling *ST runs *single locations offline online test sequences for commutativity cache (generalized version) of commutative sequences
the Janus flow find candidate sequences via profiling *ST runs *single locations test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online cache (generalized version) of commutative sequences
the Janus flow find candidate sequences via profiling *ST runs *single locations cache (generalized version) of commutative sequences test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online miss perform writeset detection
the Janus flow soundness consult sequence cache when attempting to commit a transaction online miss perform writeset detection
user input the Janus flow find candidate sequences via profiling *ST runs *single locations cache (generalized version) of commutative sequences test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online miss perform writeset detection
the Janus spec: data n 1: v 1 n 2: v 2 n 3: v 2 n 4: v 1
the Janus spec: data n 1: v 1 n 2: v 2 n 3: v 2 n 4: v 1 data node v 1 n 1 … … node neighbor n 1 n 2 n 1 n 3 … …
the Janus spec: operations n 1: v 1 n 2: v 2 data node V 1 n 1 v 2 n 2
the Janus spec: operations n 1: v 1 n 2: v 2 public void addnode(n) { nodes. add(n); } data node V 1 n 1 v 2 n 2
the Janus spec: operations n 1: v 1 n 2: v 2 public void addnode(n) { nodes. add(n); } data node V 1 n 1 v 2 n 2 insert <n. d, n> into “nodes”
the Janus spec: operations n 1: v 1 n 2: v 2 public void addnode(n) { nodes. add(n); } n 1: v 1 n 2: v 2 n. d: n data node V 1 n 1 v 2 n 2 insert <n. d, n> into “nodes”
the Janus spec: operations n 1: v 1 n 2: v 2 public void addnode(n) { nodes. add(n); } n 1: v 1 n 2: v 2 n. d: n data node V 1 n 1 v 2 n 2 insert <n. d, n> into “nodes” data node v 1 n 1 v 2 n. d n
the Janus flow find candidate sequences via profiling *ST runs *single locations cache (generalized version) of commutative sequences test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online miss perform writeset detection
sequence mining G: v 1 u v 2
sequence mining G: G’ = G v 1 u v 2
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight()
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1)
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1)
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) Remove. Edge/T 1; Has. Path/T 1
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Remove. Edge/T 1; Has. Path/T 1
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) Remove. Edge/T 1; Has. Path/T 1
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1 Remove. Edge/T 2
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1 Remove. Edge/T 2
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1 Remove. Edge/T 2; Has. Path/T 2
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1 Remove. Edge/T 2; Has. Path/T 2
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1 Remove. Edge/T 2; Has. Path/T 2; Add. Edge/T 2
sequence mining G: v 1 u v 2 G’ = G (e 1 … en) = Sort. Edges. By. Decreasing. Weight() T 1 Remove. Edge(u, v 1) b = Has. Path(u, v 1) test b Add. Edge(u, v 1) T 2 Remove. Edge(u, v 2) b = Has. Path(u, v 2) test b Add. Edge(u, v 2) return G’ Remove. Edge/T 1; Has. Path/T 1; Add. Edge/T 1 Remove. Edge/T 2; Has. Path/T 2; Add. Edge/T 2
the Janus flow find candidate sequences via profiling *ST runs *single locations cache (generalized version) of commutative sequences test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online miss perform writeset detection
commutativity checking Remove. Edge(u, v 1 ); Has. Path(u, v 1); ∙ Add. Edge(u, v 1) Remove. Edge(u, v 2 ); Has. Path(u, v 2); Add. Edge(u, v 2) Remove. Edge(u, v 2 ); Has. Path(u, v 2); ∙ Add. Edge(u, v 2) Remove. Edge(u, v 1 ); Has. Path(u, v 1); Add. Edge(u, v 1)
commutativity checking Remove. Edge(x, y) ; Has. Path(x, y); ∙ Add. Edge(x, y) Remove. Edge(x, z) ; Has. Path(x, z); Add. Edge(x, z) Remove. Edge(x, z) ; Has. Path(x, z); ∙ Add. Edge(x, z) Remove. Edge(x, y) ; Has. Path(x, y); Add. Edge(x, y)
commutativity checking Remove. Edge(x, y) ; Has. Path(x, y); ∙ Add. Edge(x, y) Remove. Edge(x, z) ; Has. Path(x, z); Add. Edge(x, z) ɸ 0 = encode(G) ɸ 1 = ɸ 0 ˄ {x, y} ϵ “edges” … ɸk = ɸk-1 ˄ {x, y} ϵ “edges” … ɸk+1 = ɸk ˄ {x, y} ϵ “edges” … ɸm = ɸm-1 ˄ {x, y} ϵ “edges” Remove. Edge(x, z) ; Has. Path(x, z); ∙ Add. Edge(x, z) Remove. Edge(x, y) ; Has. Path(x, y); Add. Edge(x, y) ψ0 = encode(G) ψ1 = ψ0 ˄ {x, z} ϵ “edges” … ψk = ψk-1 ˄ {x, z} ϵ “edges” … ψk+1 = ψk ˄ {x, y} ϵ “edges” … ψm = ψm-1 ˄ {x, y} ϵ “edges”
commutativity checking Remove. Edge(x, y) ; Has. Path(x, y); ∙ Add. Edge(x, y) Remove. Edge(x, z) ; Has. Path(x, z); Add. Edge(x, z) ɸ 0 = encode(G) ɸ 1 = ɸ 0 ˄ {x, y} ϵ “edges” … ɸk = ɸk-1 ˄ {x, y} ϵ “edges” … ɸk+1 = ɸk ˄ {x, y} ϵ “edges” … ɸm = ɸm-1 ˄ {x, y} ϵ “edges” Remove. Edge(x, z) ; Has. Path(x, z); ∙ Add. Edge(x, z) Remove. Edge(x, y) ; Has. Path(x, y); Add. Edge(x, y) ψ0 = encode(G) ψ1 = ψ0 ˄ {x, z} ϵ “edges” … ψk = ψk-1 ˄ {x, z} ϵ “edges” … ψk+1 = ψk ˄ {x, y} ϵ “edges” … ψm = ψm-1 ˄ {x, y} ϵ “edges” test: ¬(ѱ ≡ ɸ)
commutativity checking Remove. Edge(x, y) ; Has. Path(x, y); ∙ Add. Edge(x, y) Remove. Edge(x, z) ; Has. Path(x, z); Add. Edge(x, z) Remove. Edge(x, z) ; Has. Path(x, z); ∙ Add. Edge(x, z) Remove. Edge(x, y) ; Has. Path(x, y); Add. Edge(x, y) in paper: • encoding rules ψ = encode(G) checking ɸ • =“projection” encode(G) : sound commutativity ψ = ψ ˄ {x, z} ϵ “edges” ɸ = ɸ ˄ {x, y} ϵ “edges” … for sequences induced by…individual memory ψ = ψ ˄ {x, z} ϵ “edges” ɸ = ɸ ˄ {x, y} ϵ “edges” locations test: ¬(ѱ ≡ ɸ) … … 0 0 1 0 k k-1 ɸk+1 = ɸk ˄ {x, y} ϵ “edges” … ɸm = ɸm-1 ˄ {x, y} ϵ “edges” ψk+1 = ψk ˄ {x, y} ϵ “edges” … ψm = ψm-1 ˄ {x, y} ϵ “edges”
the Janus flow find candidate sequences via profiling *ST runs *single locations cache (generalized version) of commutative sequences test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online miss perform writeset detection
generalization S 1= S 2= Remove. Edge(x, y); Has. Path(x, y); Add. Edge(x, y) Remove. Edge(x, z); Has. Path(x, z); Add. Edge(x, z)
generalization S 1= S 2= Remove. Edge(x, y); Has. Path(x, y); Add. Edge(x, y) Remove. Edge(x, z); Has. Path(x, z); Add. Edge(x, z) [S 1 S 2]G // “concrete” seq. s commute
generalization S 1= S 2= Remove. Edge(x, y); Has. Path(x, y); Add. Edge(x, y) Remove. Edge(x, z); Has. Path(x, z); Add. Edge(x, z) [S 1 S 2]G // “concrete” seq. s commute S 1(G) = S 1∙S 1(G) // idempotent S 2(G) = S 2∙S 2(G) // idempotent
generalization S 1= S 2= Remove. Edge(x, y); Has. Path(x, y); Add. Edge(x, y) Remove. Edge(x, z); Has. Path(x, z); Add. Edge(x, z) [S 1 S 2]G // “concrete” seq. s commute S 1(G) = S 1∙S 1(G) // idempotent S 2(G) = S 2∙S 2(G) // idempotent
generalization S 1= S 2= Remove. Edge(x, y); Has. Path(x, y); Add. Edge(x, y) Remove. Edge(x, z); Has. Path(x, z); Add. Edge(x, z) [S 1 S 2]G // “concrete” seq. s commute S 1(G) = S 1∙S 1(G) // idempotent S 2(G) = S 2∙S 2(G) // idempotent [S 1+ S 2+]G // Kleene-cross generalization
generalization S 1= S 2= Remove. Edge(x, y); Has. Path(x, y); Add. Edge(x, y) Remove. Edge(x, z); Has. Path(x, z); Add. Edge(x, z) + + [S 1 S 2]G // “concrete” seq. s commute S 1(G) = S 1∙S 1(G) // idempotent S 2(G) = S 2∙S 2(G) // idempotent [S 1+ S 2+]G // Kleene-cross generalization
the Janus flow find candidate sequences via profiling *ST runs *single locations test sequences for commutativity offline specialized spec consult sequence cache when attempting to commit a transaction online miss cache (generalized version) of commutative sequences perform writeset detection
specialized commutativity spec operation state
specialized commutativity spec operation state Add. Edge(x, y)/tt Add. Edge(x, z)/ff any
specialized commutativity spec operation state Add. Edge(x, y)/tt Add. Edge(x, z)/ff any Add. Edge(x, y)/ff Has. Path(z, w)/tt any
specialized commutativity spec operation state Add. Edge(x, y)/tt Add. Edge(x, z)/ff any Add. Edge(x, y)/ff Has. Path(z, w)/tt any …
specialized commutativity spec operation state Add. Edge(x, y)/tt Add. Edge(x, z)/ff any Add. Edge(x, y)/ff Has. Path(z, w)/tt any … [ Remove. Edge(x, y)/tt; Has. Path(x, y)/ff; Add. Edge(x, y)/tt ]+ [ Remove. Edge(x, z)/tt; Has. Path(x, z)/ff; Add. Edge(x, z)/tt ]+ any
specialized commutativity spec operation state Add. Edge(x, y)/tt Add. Edge(x, z)/ff any Add. Edge(x, y)/ff Has. Path(z, w)/tt any … [ Remove. Edge(x, y)/tt; Has. Path(x, y)/ff; Add. Edge(x, y)/tt ]+ [ Remove. Edge(x, z)/tt; Has. Path(x, z)/ff; Add. Edge(x, z)/tt ]+ tailored for given application any
the Janus flow find candidate sequences via profiling *ST runs *single locations cache (generalized version) of commutative sequences test sequences for commutativity offline consult sequence cache when attempting to commit a transaction online miss perform writeset detection
parallelization protocol shared state [k] b 1 b 2. . . bm privatized state [k] shared state [k+1] privatized state [k’] shared state [k+2] (a 1 … an) ∙ (b 1 … bm) Sk ≡ (b 1 … bm) ∙ (a 1 … an) Sk a 1 a 2. . . an
parallelization protocol shared state [k] b 1 b 2. . . bm privatized state [k] shared state [k+1] privatized state [k’] shared state [k+2] (a 1 … an) ∙ (b 1 … bm) Sk ≡ (b 1 … bm) ∙ (a 1 … an) Sk a 1 a 2. . . an
parallelization protocol shared state [k] privatized state [k] shared state [k+1] privatized state [k’] replay bi on shared state [k+2] shared state [k+3]
parallelization protocol shared state [k] b 1 b 2. . . bm privatized state [k] shared state [k+1] privatized state [k’] shared state [k+2] (a 1 … an) ∙ (b 1 … bm) Sk ≡ (b 1 … bm) ∙ (a 1 … an) Sk a 1 a 2. . . an
parallelization protocol shared state [k] retry privatized state [k+2] shared state [k+1] shared state [k+2]
parallel reverse-delete MST
parallel reverse-delete MST
parallel reverse-delete MST
parallel reverse-delete MST
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1)
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1)
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2)
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2)
parallel reverse-delete MST Remove. Edge(u, v 3) Has. Path(u, v 3) Add. Edge(u, v 3) Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2)
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 3) Has. Path(u, v 3) Add. Edge(u, v 3) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2) ?
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 3) Has. Path(u, v 3) Add. Edge(u, v 3) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2) x. f = y; || z = x. f;
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 3) Has. Path(u, v 3) Add. Edge(u, v 3) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2) dope!
parallel reverse-delete MST operation state Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v b 1) any Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2) … Remove. Edge(u, v 3) [ Remove. Edge(x, y)/tt; Has. Path(u, v 3) Has. Path(x, y)/ff; + Add. Edge(u, v 3) Add. Edge(x, y)/tt ] [ Remove. Edge(x, z)/tt; Has. Path(x, z)/ff; Add. Edge(x, z)/tt ]+
parallel reverse-delete MST Remove. Edge(u, v 1) Has. Path(u, v 1) Add. Edge(u, v 1) Remove. Edge(u, v 3) Has. Path(u, v 3) Add. Edge(u, v 3) Remove. Edge(u, v 2) Has. Path(u, v 2) Add. Edge(u, v 2) that’s better. .
benchmarks name description JFile. Sync utility for synchronizing pairs of directories JGraph. T-1 (coloring) greedy graph-coloring algorithm JGraph. T-2 (ordering) saturation-degree node-ordering algorithm for heuristic graph coloring PMD Java source code analyzer Weka machine-learning library for data-mining tasks
2. 5 JGraph. T-1 2 2 1. 5 1 1 0. 5 0 speedu JGraph. T-2 p 0 Seq 2. 5 1 2 3 4 5 6 7 8 2. 5 PMD 2 Seq 1 2 3 4 5 6 7 8 JFile. Sync 2 1. 5 1 1 0. 5 0 Seq 1 2 3 4 5 6 7 8 0 Seq 2. 5 Fine-grained conflict detection 1 Weka 2 1. 5 Coarse-grained conflict detection 1 0. 5 Sequential 0 Seq 1
4. 5 4 3. 5 3 2. 5 2 1. 5 1 0. 5 0 JGraph. T-1 1 4. 5 4 3. 5 3 2. 5 2 1. 5 1 0. 5 0 2 3 4 5 6 7 8 1 2 1 4. 5 4 3. 5 3 2. 5 2 1. 5 1 0. 5 0 PMD 3 4 5 6 7 Fine-grained conflict detection Coarse-grained conflict detection 8 retries JGraph. T-2 2 3 4 5 6 7 8 JFile. Sync 1 4. 5 4 3. 5 3 2. 5 2 1. 5 1 0. 5 0 2 Weka 1 2
misses 90% 80% 70% 60% 50% 40% 30% 20% 10% JGraph. T-2 JGraph. T-1 JFile. Sync W/ seq. abstraction PMD Weka W/O seq. abstraction 0%
conclusions profiling is useful for speculation • prevalent behaviors (dependencies) => effective specialization • speculation = safety net Janus enables practical accuracy boosting • lifts commutativity checking to sequences of operations • runtime overhead comparable to write-set approach












































































































































