symmetry-aware predicate abstraction for shared-variable concurrent programs

80
Symmetry-Aware Predicate Abstraction for Shared- Variable Concurrent Programs Alastair Donaldson, Alexander Kaiser, Daniel Kroening, and Thomas Wahl Computer Science Department, Oxford University, United Kingdom Limor Goldberg 15.4.2012

Upload: talor

Post on 22-Feb-2016

51 views

Category:

Documents


0 download

DESCRIPTION

Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs. Alastair Donaldson, Alexander Kaiser, Daniel Kroening , and Thomas Wahl Computer Science Department, Oxford University, United Kingdom Limor Goldberg 15.4.2012. Outline. Introduction - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Symmetry-Aware Predicate Abstraction for Shared-

Variable Concurrent Programs

Alastair Donaldson, Alexander Kaiser, Daniel Kroening, and Thomas Wahl

Computer Science Department, Oxford University, United Kingdom

Limor Goldberg

15.4.2012

Page 2: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Outline

Introduction Symmetry-Aware Predicate Abstraction Symmetry-Aware Predicate Abstraction

with aliasing Closing the CEGAR Loop Experimental results Conclusion

Page 3: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Introduction

Page 4: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Introduction

Overview Predicate Abstraction Example Uses of predicate abstraction Naïve solution

Page 5: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Overview

Enables applying finite- state model checkers to programs written in mainstream languages

The use of predicate abstraction till now

Goal: present an application of PA to shared variable concurrent

software

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Page 6: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Overview

A symmetry aware predicate abstraction: Consider the replicated structure of a C

program consists of many threads Generate a boolean program

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Page 7: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Predicate Abstraction

Predicate: A first order atomic formula over variables V

Examples: x+y<z2, x=5

Let Þ be a program and let φ be an ACTL* formula,AP = {P1,….,Pk} ,includes:• Atoms(φ), the set of predicates appearing in φ• Some of the conditions in control statements in

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Page 8: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Predicate Abstraction

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

The abstract states: {B1,…,Bk} when each predicate Pj is associated with a boolean

variable Bj

The Abstraction mapping h: h(s)=

ˆ 0,1 kS

Page 9: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

States label: • A concrete state labeled with all the

predicates it satisfied.

• An abstract states labeled with predicate the corresponding bit is 1 in that state.

Example:

Predicate Abstraction

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Page 10: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

• let be a program with variable x,y and a single transition x:=x+1.

• AP={P1,P2,P3} where:• P1 = ( x 1 )• P2 = ( x>y )• P3 = ( y=2 )

Some of the labels are:• L((0,0)) = L((1,1)) = L((0,1)) = {P1} • L((0,2)) = L((1,2)) = {P1, P3}• L((2,0)) = {P2}

Example

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Page 11: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Example

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

• let be a program with variable x,y and a single transition x:=x+1.

• AP={P1,P2,P3} where: P1 = ( x 1 ) , P2 = ( x>y ) , P3 = ( y=2 )

• S = {s, t} • s(x) = s(y) = 0• t(x) = 1, t(y) = 2

• L(s) = {P1} , L(t) = {P1, P3}

Page 12: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Example

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

• let be a program with variable x,y and a single transition x:=x+1.

• AP={P1,P2,P3} where: P1 = ( x 1 ) , P2 = ( x>y ) , P3 = ( y=2 )

• {0,1}3 .• We define the abstraction mapping h:

• h((0,0)) = h((1,1)) = h((0,1)) = (1,0,0)• h((0,2)) = h((1,2)) = (1,0,1)• h((2,0)) = {P2} = (0,1,0)

Page 13: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Example

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

• let be a program with variable x,y and a single transition x:=x+1.

• AP={P1,P2,P3} where: P1 = ( x 1 ) , P2 = ( x>y ) , P3 = ( y=2 )• S = {s, t} : s(x) = s(y) = 0 , t(x) = 1, t(y) = 2• L(s) = {P1} , L(t) = {P1, P3}

• the abstraction mapping h:• h(s) = (1,0,0), h(t) = (1,0,1).

• ( ) = (1,0,0) = L(s) = {P1} • ( ) = (1,0,1) = L(t) = {P1, P3}

Page 14: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Example

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

1 2 3 1 2 3

1 1 2 2 3 3

1 1 2 2 3 3

ˆ , , , ', ', '

, , ,, , ', ' ' 1 '

', ' ' ', ' ' ', ' '

R B B B B B B

P x y B P x y B P x y Bx y x y x x y y

P x y B P x y B P x y B

(1,1)

(2,1)

(1,0,0)

(0,1,0)

• Example:• For (1,0,0) and (0,1,0) :

• They are in iff exist x,y,x’,y’ which satisfied the formula above.

• We can see that (1,1) and (2,1) provide all we need

Page 15: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Uses of predicate abstraction

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Predicate abstraction introduces as a way of dealing with data state explosion

It turns C programs into finite state boolean programs which can be model checked

Analyzing sequential software: In the SLAM project at Microsoft, using this

approach, was able to discover numerous control-dominated errors in low level operating system code.

Page 16: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Uses of predicate abstraction

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

The bottleneck of PA in shared variable concurrent programs: the exponential dependence of the generate state

apace on the number of running threads.

Solution – exploit symmetry

Page 17: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Uses of predicate abstraction

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Our goal is a scheme that:

Translate a non-recursive C program with global scope and procedure scope into a Boolean program

The n-thread Boolean program (n), shell soundly overapproximates the n-thread C program (n)

Such an abstraction method called – symmetry aware Permits predicates over arbitrary C programs variables,

local or global.

Page 18: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Uses of predicate abstraction

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

We present program as code fragments that declare shred and local variables.

such code is to be understood as a procedure to be executed by any number of threads

The code can declare shared variables – declared at the global scope (the complete program)

Can declare local variables (within the procedure)

Page 19: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Since the program B is executed by parallel threads its variables have to be partitioned into “shared” and “local” .

The “shared” and “local” attribute of B’s variables depend on the attributes of P’s variables a predicate is formulated over.

Definition:- A local predicate refers solely to a local C program variables- A shared predicate refers solely to a shared C program

variables- A mixed predicate is neither local nor shared.

Page 20: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Definition:- A local predicate refers solely to a local C program variables- A shared predicate refers solely to a shared C program variables- A mixed predicate is neither local nor shared.

Example to mix predicate:let s and l be a shared and local variables

respectively.b is a boolean corresponding to the predicate: s !=

l Thus b is a mix variable

Page 21: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

The decision whether a mix predicate should be track in the shared or local space in the Boolean program is non-obvious.

Example: local variable b track the mix predicate s != l

: :

shared int s = 0;local int l = 1;assert s != l;++s;

local bool b = 1;

assert b;b = b ? * : 1 ;

Page 22: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

: :

What’s the problem?

Consider the program 2 : we can see that execute this program can lead to an assertion violation.But, the corresponding concurrent Boolean program 2 is correct. 2 is an unsound abstraction for 2

shared int s = 0;local int l = 1;assert s != l;++s;

local bool b = 1;

assert b;b = b ? * : 1 ;

Page 23: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

So, we’ll try to track a mix predicate with a shared Boolean variable:

Example: shared variable b tracks the mix predicate s == l

: :

shared int s = 0;shared bool t = 0;local int l = 0;If * then if t then assert s != l;l = s + 1;t = 1;

shared bool b = 1;shared bool t = 0;

If * then if t then assert ! b;b = 0;t = 1;

Page 24: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

: :

Still, we have the same problem!

2 is an unsound abstraction for ’2

shared int s = 0;shared bool t = 0;local int l = 0;If * then if t then assert s != l;l = s + 1;t = 1;

shared bool b = 1;shared bool t = 0;

If * then if t then assert ! b;b = 0;t = 1;

Page 25: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

The unsoundness can be eliminated by making b local in .

But, an analogous reasoning removes the unsoundness in as abstraction to .

Conclusion: a predicate of the form s == l that genuinely depends on s and l cannot be tracked by a shared or a local variable

Page 26: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The assertion in this program cannotcannot be violated

We can prove that over a set od nonmixed predicates, no invariant is computable that is strong enoughto prove s == l.

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

0: shared int s = 0;1: shared int r = 0;2: local int l = 0;3: ++r;4: if ( r == 1 ) then5: ++s; ++l;6: assert s == l;7: goto 5

Page 27: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Solution:

• Instantiate the template n times into programs {1, . . ., n}

• Every predicate refers to local variables instantiated n times

Page 28: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Naïve solution - summarize

• Overview• Predicate Abstraction• Example• Uses of predicate abstraction• Naïve solution

Mixed predicate as local Make unsound abstraction

Mixed predicate as shared Make unsound abstraction

Use only shared or local predicate Cannot verify a simple bug-free program

Instantiate the template as the number of threads The program is no longer symmetric – cause state explosion Symmetry oblivious – will not scale beyond a very small

number of threads

Page 29: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Symmetry Aware Predicate Abstraction

Page 30: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Symmetry Aware Predicate Abstraction

Definitions Mixed predicate and notify all updates Implementing Notify-All updates The predicate abstraction algorithm

Page 31: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Definitions VS : a set of shared variables VL : a set of local variables Loc() = {v: v occurs in } affects(v, ) = variable v affects must_notify(v, ) = the shared variable v

affects the mixed predicate A predicate i is :

shared iff Loc(i) VS local iff Loc(i) VL mixed iff Loc(i)VSand Loc(i)VL

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 32: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Let be a program defined over a set of variables V = VS VL

The parallel execution of by n threads is a program defined over VS and n copies of VL .

• No aliasing • Assignment to v cannot modify another variable

but v• An expression depends only on the variables

occurring in it

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 33: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Mix predicates and Notify-All updates

Let E = {1, … , m} be a set of predicates over .

{b1, … , bm} is the Boolean variables in program .

bi tracks over predicate i .

We partition the boolean variables:bi is shared if i is shared.otherwise, bi is local.

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 34: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Mix predicates and Notify-All updates

We have noticed that mixed predicate are tracked in local variables

Why?

Declaring bi shared would lose information,

declaring it local doesn’t – though, it is insufficient to guarantee a sound abstraction. This is a problem we can solve!

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 35: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Mix predicates and Notify-All updates

Each statement in is translated into a corresponding statement in

Handling assignments:consider an assignment to variable v in and a

Boolean variable b of with associated predicate :- First we check affects (v, )

- if it evaluates to false – b does not change- otherwise, code needs to be generated to update b.

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 36: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Mix predicates and Notify-All updates

We need to consider three different update of b:

1. Shared update - v and are both shared :

we generate code to update b according to the

(*)standard sequential predicate abstraction rule.

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 37: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Mix predicates and Notify-All updates

2. Local update - v is local and is local or mixed:

the value of b changes only for the active thread.

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 38: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Mix predicates and Notify-All updates

3. Notify-All update - v is shared and is mixed:

the mixed predicate is tracked by local variable b.1. We generate code to update b locally (like in previous cases)2. We notify all passive threads about the modification of shared

variable v (and they will update their local copy of b)

this formula evaluates to true exactly when its necessary to notify passive threads of an update to v

• Definitions• Mixed predicate• Notify All implementation• The algorithm

_ , , S Lmust notif y v aff ects v v V Loc V

Page 39: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest precondition

For a statement st and a predicate WP(st , ) is the weakest predicate whose truth before s

entails the truth of after st terminates.

For example: WP (x=x+1 , x<5) = (x<4)

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 40: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest preconditionStatement st occurs between program points p and p’. is a predicate in E with corresponding boolean b.

it is safe to assign b:=true between p and p’ if the boolean variable , b’ , corresponding to WP(st, ) is true at point p.

But , what happened if WP(st, ) isn’t in E ?

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 41: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest preconditionExample:

E = {(x<5) , (x=2) }we have seen that WP(x=x+1,x<5) = x<4but x<4 is not in E.

In that case we need to strengthen the WP to an expression over the predicated in E.

(x = 2) (x<4)if (x=2) is true before x:=x+1, then x<5 is true afterwards

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 42: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest preconditionExample:

E = {(x<5) , (x=2) }we have seen that WP(x=x+1,x<5) = x<4but x<4 is not in E.

In that case we need to strengthen the WP to an expression over the predicated in E.

(x = 2) (x<4)if (x=2) is true before x:=x+1, then x<5 is true afterwards

(WP(st, )) the strengthens of WP.

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 43: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest precondition(*) sequential predicate abstraction:

Given a set E = {1, … , m} of predicates tracked by variable {b1, … , bm} , assignment statement st is translated into the following code, for each i {1,…,m}:

if (WP(st, i)) then bi = 1else if (WP(st,i)) then bi = 0else bi = *

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 44: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest preconditionFor example: : (l<10) tracked by b,

E={} , st: (++l)

( WP(st, ) ) = ( l < 9 ) = false( WP(st, ) ) = ( l 9) = l 10 =

So, according to the previous formula:b = ( b ? * : 0 )

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 45: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Weakest precondition

In general, the formula is often abbreviated using the assignment:

bi = choose (( WP(st, i) ) , ( WP(st, i) ) )

Where choose (x,y) return 1 if x evaluates to true, 0 if x y evaluates to true * otherwise

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 46: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Implementing Notify-All updates

If must_notify( v, ) evaluated to true tracked in by a local boolean , b.

Predicate abstracting an assignment of the form v = is implemented using two assignments.

(1) b = choose (( WP(st, ) ) , ( WP(st, ) ) )(2) [b] = choose (( WP(st, []) ) , ( WP(st, ]) ) )

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 47: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Implementing Notify-All updates

[b] stands for the copy of local variable b owned by some passive thread

Similarly, [] stands for the expression defining predicate , but with every local variable occurring in the expression replaced by the copy owned by the passive thread

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 48: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Implementing Notify-All updates

(1) b = choose (( WP(st, ) ) , ( WP(st, ) ) )(2) [b] = choose (( WP(st, []) ) , ( WP(st, ]) ) )

Example:Statement: (s = l) shared and local variableMixed predicate, : (s == l)

The code generated for this is:b = true[b] = choose (( WP(s=l, s==[l]) ) , ( WP(s=l, (s==[l]) ) ))

[b] = choose ((l==[l]) , ( WP(s=l, (l==[l]) ) ))

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Page 49: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The Algorithm

• Definitions• Mixed predicate• Notify All implementation• The algorithm

𝒢 (𝜙 )=¬ℱ (¬ (𝜙 ))

Page 50: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The Algorithm

• Definitions• Mixed predicate• Notify All implementation• The algorithm

Indexes of all the predicate that that effected by v

Page 51: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The Algorithm

• Definitions• Mixed predicate• Notify All implementation• The algorithm

When v is shared, indexes of mixed predicate s.t the corresponding boolean predicate is local and needs to be updated separately

Page 52: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Symmetry Aware Predicate Abstraction

with Aliasing

Page 53: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Symmetry Aware Predicate Abstraction with

Aliasing

Assumptions Definitions The algorithm

Page 54: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Assumptions We don’t consider programs where a shared pointer

variable, or pointer variable local to thread i, can point to a variable local to thread j (when i j).

When p is a local variable of type int*, and predicate :(*p ==1), is local if p can never point to a shared variable, otherwise, is classed as mixed.

We have a black box pointer alias analysis for concurrent programs. For a program over variable v, it yields the relation d VxV for each program location d.

• Assumptions• Definitions• The algorithm

Page 55: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Definitions For v,w V, if vdw then v doesn’t point to w at d. loc(,d) = the set of variables that it may be necessary to

access in order to evaluate expression in point d. loc(z, d) = for a constant value z loc(v, d) = {v} loc(&v, d) = loc v, d) = {v} {loc( w,d) | v d w}

Loc() = loc(,d) targets(x,d) = the set of variables that may be modified by

writing to l-value x at program point d. targets(v, d) = {v} targets(*v, d) = {w V | v d w}

• Assumptions• Definitions• The algorithm

Page 56: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Predicate Abstraction Algorithm with Aliasing

We define predicate to be shared local or mixed with respect to alias information with the new definition of Loc.

Without pointers we defined affects(v, ) = (v Loc() ) indicate that updating v may affect the truth of .

with pointers this definition is not sufficient.the truth of may be affected by assigning to l-value x

if some variable that depends on points to x.

Now: affects(x, , d) = (target(x,d) loc(, d) )

• Assumptions• Definitions• The algorithm

Page 57: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

must_notify Again, we need to determine whether an update affects

the truth of a predicate only for the threads executing the update, or for all threads.

We need to define must_notify like we did without aliasing.

• Assumptions• Definitions• The algorithm

Page 58: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

must_notify – first try The previous definition (without aliasing) was:

So, we can try to adapt it to this situation with the new definitions:

_ , , S Lmust notif y v aff ects v v V Loc V

_ , , , ,arg , S L

must notif y x d aff ects x d

t ets x d V Loc V

• Assumptions• Definitions• The algorithm

Page 59: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

must_notify – first trySuppose we have the following variables:

• shared s, t• local l• local pointer p

s.t : p d t and p d l• : ( s < l )

Consider an assignment to *p at point d:The only shared variable that can be modified is t, and the truth of doesn’t depend on it.

• Assumptions• Definitions• The algorithm

Page 60: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

must_notify – second trySecond Try

Meaning: is mixed and , and exists variable v that may changed as a results of writing to x at point d, and one must access v to evaluate .

The predicate abstraction algorithm can now be adapted to handle pointers

_ , , arg , S

L

must notif y x d t ets x d V Loc

Loc V

• Assumptions• Definitions• The algorithm

Page 61: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The Algorithm

• Assumptions• Definitions• The algorithm

Page 62: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The CEGAR loop

Page 63: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

The CEGAR Loop

Reminder Adept CEGAR loop to handle concurrency

Page 64: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Remainder

Th is not spuriouscheck spuriouscounterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |= model check

Mh

generate initialabstraction

M and

refinement

This spurious

• Remainder• CEGAR loop with concurrency

Page 65: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Remainder

Th is not spuriouscheck spuriouscounterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |= model check

Mh

generate initialabstraction

M and

refinement

This spurious

• Remainder• CEGAR loop with concurrency

Page 66: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Remainder

Th is not spuriouscheck spuriouscounterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |= model check

Mh

generate initialabstraction

M and

refinement

This spurious

• Remainder• CEGAR loop with concurrency

Page 67: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Remainder

Th is not spuriouscheck spuriouscounterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |= model check

Mh

generate initialabstraction

M and

refinement

This spurious

• Remainder• CEGAR loop with concurrency

Page 68: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

spuriouscounterexample

x1

x2

y1

y2

X Y

Considering the counterexample Y X Y :This path exists only in the abstract model

• Remainder• CEGAR loop with concurrency

Page 69: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Remainder

Th is not spuriouscheck spuriouscounterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |= model check

Mh

generate initialabstraction

M and

refinement

This spurious

• Remainder• CEGAR loop with concurrency

Page 70: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Remainder

Th is not spuriouscheck spuriouscounterexample

Th

stop

Mh |=

generatecounterexample Th

Mh |= model check

Mh

generate initialabstraction

M and

refinement

This spurious

• Remainder• CEGAR loop with concurrency

Page 71: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Adept CEGAR loop to handle concurrency

Model checking boolean broadcast program

Simulation

Refinement

• Remainder• CEGAR loop with concurrency

Page 72: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Model checking boolean broadcast program

We can no longer use existing concurrent Boolean program model checkers such as Boom (*).

A prototype extension of Boom which called B-Boom can overcome the problem that the new syntax and semantics for broadcasts created.

B-Boom extends the capabilities of Boom to support broadcast operations.

• Remainder• CEGAR loop with concurrency

Page 73: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Simulation

The existing SATABS simulator: extracts the control flow from the trace Mapped it back to the original C program Translate it into a propositional formulaThe error is spurious exactly if the formula is unsatisfiable

For concurrent case the control flow information of an abstract trace includes which thread executes actively in each steps.

An extended version of the SATABS create a trace over a replicated C program which can be checked using SAT

• Remainder• CEGAR loop with concurrency

Page 74: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Refinement

The implementation performs refinement by extracting new predicates from counterexample via WP calculations.

• Remainder• CEGAR loop with concurrency

Page 75: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Experimental results

Page 76: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Experimental results

Symmetry-aware vs. Symmetry oblivious

Sound abstraction vs. unsound abstraction

Page 77: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Symmetry awarevs.

Symmetry oblivious Reminder:

SOPA: an n-thread symmetric concurrent program expanded so that variables for all threads are

explicitly duplicated and n copies of all non-shared predicate are generated.

Page 78: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs
Page 79: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs

Sound Absvs.

Unsound AbsReminder:

we saw Unsound Abstraction in the two naïve solutions to the mixed predicate problem.

Page 80: Symmetry-Aware Predicate Abstraction for Shared-Variable Concurrent Programs