Structural counter abstraction Proving fair-termination of depth - - PowerPoint PPT Presentation

structural counter abstraction
SMART_READER_LITE
LIVE PREVIEW

Structural counter abstraction Proving fair-termination of depth - - PowerPoint PPT Presentation

Structural counter abstraction Proving fair-termination of depth bounded systems Kshitij Bansal 1 with Eric Koskinen 1 , Thomas Wies 1 , Damien Zufferey 2 1 New York University 2 IST Austria March 18, 2013 TACAS, Rome, Italy Introduction


slide-1
SLIDE 1

Structural counter abstraction

Proving fair-termination of depth bounded systems Kshitij Bansal1

with Eric Koskinen1, Thomas Wies1, Damien Zufferey2

1New York University 2IST Austria

March 18, 2013

TACAS, Rome, Italy

slide-2
SLIDE 2

Introduction

◮ Model: Depth-bounded systems

Graph-rewrite based transition systems, which can be used to model concurrent heap-manipulating algorithms, as well as distributed systems.

◮ Problem: Fair-termination problem

Fairness: If a transition is continuously enabled after some point, it is taken infinitely often.

◮ Application: Proving progress properties of concurrent and

distributed systems.

slide-3
SLIDE 3

Treiber stack

stack node node · · · Top next next

slide-4
SLIDE 4

Treiber stack

stack node node · · · Top next next push pop · · ·

slide-5
SLIDE 5

Treiber stack

stack node node · · · Top next next push push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) );

slide-6
SLIDE 6

Treiber stack

stack node node · · · Top next next push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) ); pc1 s

slide-7
SLIDE 7

Treiber stack

stack node node · · · Top next next push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) ); pc1 s pc2 t node x next

slide-8
SLIDE 8

Treiber stack

stack node node · · · Top next next push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) ); pc1 s pc2 t node x next

slide-9
SLIDE 9

Treiber stack

stack node node · · · next next push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) ); pc1 s pc2 t node x next node Top next

slide-10
SLIDE 10

Treiber stack

stack node node · · · next next push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) ); pc1 s pc2 t node x next node Top next

slide-11
SLIDE 11

Treiber stack

stack node node · · · next next push(s, data): do { pc1: t = s->top; x = new node(t, data); pc2: }while( !CAS(s->top, t, x) ); pc1 s node Top next

slide-12
SLIDE 12

Lock freedom as fair termination

◮ Treiber stack is lock-free.

◮ guarantees global progress: some thread will finish ◮ individual threads might starve

◮ Reduced to termination problem where arbitrarily many but

finite number of threads are present.

◮ A transition which spawns processes at will, along with a

fairness constraint can be used to encode this.

slide-13
SLIDE 13

Lock freedom as fair termination

◮ Treiber stack is lock-free.

◮ guarantees global progress: some thread will finish ◮ individual threads might starve

◮ Reduced to termination problem where arbitrarily many but

finite number of threads are present.

◮ A transition which spawns processes at will, along with a

fairness constraint can be used to encode this.

◮ Challenge: Unbounded number of heap objects and thread

  • bjects.
slide-14
SLIDE 14

Contribution

◮ Work with symbolic graphs which can model structures that

arise commonly in these systems, and required to be tracked to prove termination.

◮ Contribution: We introduce a counter abstraction derived

from these, thus called structural counter abstraction. It is sufficiently refined to be able to prove progress properties like lock-freedom of Treiber stack.

slide-15
SLIDE 15

Related work

Counter abstraction for concurrent systems

◮ A. Pnueli, J. Xu, and L. D. Zuck. Liveness with (0, 1,

∞)-counter abstraction. In CAV, 2002.

◮ G. Basler, M. Mazzucchi, T. Wahl, and D. Kroening.

Symbolic counter abstraction for concurrent software. In CAV, 2009.

slide-16
SLIDE 16

Related work

Counter abstraction for concurrent systems

◮ A. Pnueli, J. Xu, and L. D. Zuck. Liveness with (0, 1,

∞)-counter abstraction. In CAV, 2002.

◮ G. Basler, M. Mazzucchi, T. Wahl, and D. Kroening.

Symbolic counter abstraction for concurrent software. In CAV, 2009. Graph-based analysis

◮ J. Berdine, B. Cook, D. Distefano, and P. W. O’Hearn.

Automatic termination proofs for programs with shape-shifting heaps. In CAV, 2006.

◮ S. Gulwani, T. Lev-Ami, and M. Sagiv. A combination

framework for tracking partition sizes. In POPL, 2009.

slide-17
SLIDE 17

Outline

Introduction Model (nested graphs) Structural counter abstraction Implementation and conclusion

slide-18
SLIDE 18

Model

Graph Transformation Systems

◮ States: graphs. In our case, symbolic graphs (on next slide). ◮ Rules: rewrite one subgraph with another.

stack node pc1 s top stack pc2 node node s top t x Prepare rule Other rules: Spawn CAS succeed CAS fail

slide-19
SLIDE 19

Nested graphs

stack represent arbritrary number of copies. node Top pc1 s

slide-20
SLIDE 20

Nested graphs

stack node Top pc1 s pc2 s pc2 s node x node x t node t

slide-21
SLIDE 21

stack node Top pc1 s pc2 s pc2 s node x node x t node t Nested subgraphs represent arbitrary number of copies of the subgraphs stack node Top pc1 s pc1 pc1 pc2 s t node x pc2 node pc2 s node x node t pc2 s node x node t pc2 node

slide-22
SLIDE 22

Inductive invariant

stack node Top pc1 s pc2 s pc2 s node x node x t node t

stack node Top pc1 s pc2 s pc2 s node x node x t node t pc2 s node t x

prepare

slide-23
SLIDE 23

Inductive invariant

stack node Top pc1 s pc2 s pc2 s node x node x t node t

stack node Top pc1 s pc2 s pc2 s node x node x t node t pc2 s node t x

prepare cover

slide-24
SLIDE 24

Inductive invariant

stack node Top pc1 s pc2 s pc2 s node x node x t node t

stack node Top pc1 s pc2 s pc2 s node x node x t node t pc2 s node t x

prepare cover Gfail Gsucceed

CAS fail cover CAS succeed cover

slide-25
SLIDE 25

Structural counter abstraction

Input: Rewrite-rules, Inductive invariant as nested graphs Output: Counter system Graph system → Counter system Nested graphs → Control locations Nodes in nested graphs → Counters Rule applications → Counter updates

  • Soundness. If the graph transition system has a fair

non-terminating run, then the counter system will have a fair non-terminating run.

slide-26
SLIDE 26

stack node Top pc1 s pc2 s pc2 s node x node x t node t

y1 y2 y3 y4 y5 y6 y7 y8

l1

slide-27
SLIDE 27

stack node Top pc1 s pc2 s pc2 s node x node x t node t

y1 y2 y3 y4 y5 y6 y7 y8

l1

stack node Top pc1 s pc2 s pc2 s node x node x t node t pc2 s node t x

y1 y2 y3 y4 y5 y6 y7 y8 y9 y10

l2

prepare cover

prepare: (l1, { y′

9 = 1, y′ 10 = 1, y′ 5 = y5 − 1, identity on rest } , l2)

cover: (l2, { y′

1 = y1 + y9, y′ 9 = 0, y′ 2 = y10 + y2, y′ 10 = 0, identity

  • n rest } , l1)
slide-28
SLIDE 28

Computing Inductive Invariant

◮ Depth bounded systems: class of well-structured transition

systems [Meyer, 2008]. It says if the length of the longest simple path is bounded, then system is well-structured with the ordering given by subgraph homomorphism.

◮ Analysis to compute over-approximation of set of reachable

states of the WSTS [Ideal abstraction, Zufferey, Wies, Henzinger, 2012]. This overapproximation is a downward closed set, also inductive, given as finite union of states represented by the nested graphs.

◮ Many concurrent and distributed process can be modeled as

depth-bounded processes for proving termination (Treiber stack without next, etc.)

slide-29
SLIDE 29

Implementation

Input: Graph rewrite system.

  • 1. Picasso1 computes the inductive invariant as nested

graphs[ZWH’12].

  • 2. Picasso extended to compute the counter abstraction from

the invariant[this work].

  • 3. Counter program is fed to termination prover for counter

systems, ARMC [Andrey Rybalchenko, Andreas Podelski]. We also use Z3 [Leonardo de Moura, Nikolaj Bjorner] and Princess[Philipp R¨ ummer] for variable elimination to optimize counter abstraction.

1http://pub.ist.ac.at/~zufferey/picasso/

slide-30
SLIDE 30

Experimental Results

Example #loc #v #t

  • I

N Armc Total Split/merge 4 3 9 1.5 6.8 0.1 8.4 Work stealing, 3 processors 4 4 20 1.7 13.1 0.2 15.0 Work stealing, parameterized 2 3 4 1.5 5.6 0.1 6.2 Compute server job queue 2 5 4 1.6 6.1 0.1 7.8 Chat room 5 34 80 9.8 61.3 5 min 6 min Map reduce 6 10 15 2.0 8.8 0.2 11.0 Map reduce with failure 6 15 21 2.3 11.1 0.9 14.3 Treiber’s stack (coarse-grained) 2 6 4 1.9 7.2 0.2 9.3 Treiber’s stack (fine-grained) 3 14 13 2.7 14.2 1.2 17.1 Herlihy/Wing queue 3 16 25 3.8 24.9 6.5 34.2 Michael/Scott queue (dequeue only) 4 7 23 2.8 13.0 0.6 16.4 Michael/Scott queue (enqueue only) 7 15 53 3.8 43.7 7.6 55.1 Michael/Scott queue 9 31 224 25.0 265.0 3 wks 3 wks

Table : The columns show the number of locations, variables, and transitions in the counter abstraction, and the running times, in seconds, for computing the inductive invariant, constructing the abstraction, and for proving termination.

slide-31
SLIDE 31

Related work

◮ R. Meyer. On boundedness in depth in the π-calculus. In

Fifth Ifip International Conference On Theoretical Computer Science–Tcs 2008, 2008.

◮ A. Pnueli, J. Xu, and L. D. Zuck. Liveness with (0, 1,

∞)-counter abstraction. In CAV, 2002.

◮ G. Basler, M. Mazzucchi, T. Wahl, and D. Kroening.

Symbolic counter abstraction for concurrent software. In CAV, 2009.

◮ S. Gulwani, T. Lev-Ami, and M. Sagiv. A combination

framework for tracking partition sizes. In POPL, 2009.

◮ S. Joshi and B. K¨

  • nig. Applying the graph minor theorem to

the verification of graph transformation systems. In CAV, 2008.

◮ A. Gotsman, B. Cook, M. J. Parkinson, and V. Vafeiadis.

Proving that non-blocking algorithms don’t block. In POPL, 2009.

slide-32
SLIDE 32

Conclusion

◮ Novel technique for proving fair termination of DBS that can

be used to prove progress properties of concurrent data structures and distributed systems.

◮ An analysis that is both practical and sufficiently precise built

  • n top of existing termination provers for counter systems.