Model checking with Message Sequence Charts Doron Peled - - PowerPoint PPT Presentation

model checking with message sequence charts
SMART_READER_LITE
LIVE PREVIEW

Model checking with Message Sequence Charts Doron Peled - - PowerPoint PPT Presentation

Model checking with Message Sequence Charts Doron Peled Collaborators: R. Alur, E. Gunter, G. Holzmann, A. Muscholl, Z. Su Department of Computer Science University of Warwick, UK Bar Ilan University, IL MSCs An ITU standard notation


slide-1
SLIDE 1

Model checking with Message Sequence Charts

Doron Peled Collaborators: R. Alur,

  • E. Gunter, G. Holzmann,
  • A. Muscholl, Z. Su

Department of Computer Science University of Warwick, UK Bar Ilan University, IL

slide-2
SLIDE 2

MSCs

An ITU standard notation (Z120). Visual + Textual forms. Specifies behaviors of communication

protocols.

Existing algorithms + tools.

slide-3
SLIDE 3

MSC visual notation

P1 P3 P2 M1 M2 M3 M4 M5 M6

slide-4
SLIDE 4

MSC Textual form

msc MSC; inst P1: process Root, P2: process Root, P3: process Root; instance P1;

  • ut M1 to P2;

in M5 from P2; in M6 from P3; endinstance; instance P2; in M1 from P1;

  • ut M2 to P3;
  • ut M3 to P3;

in M4 from P3;

  • ut M5 to P1;

endinstance;

P1 P3 P2

M1 M2 M3 M4 M5 M6

instance P3; in M2 from P2; in M3 from P2;

  • ut M4 to P2;
  • ut M6 to P1;

endinstance; endmsc;

slide-5
SLIDE 5

Partial order semantics: How exactly?

P1 P3 P2

M1 M2 M3 M4 M5 M6

V - Set of events (vertices). N - names. P - processes. p:VP maps events to processes. E - Set of edges (orders, to be fixed). n: VN naming function. t: V {s, r, l} matches a type (send, receive, local). mVxV - matching of sends and receives with same name and

  • pposite types.
slide-6
SLIDE 6

HMSCs: a graph of MSCs (again, what semantics?)

P1 P3 P2 P1 P3 P2 P1 P3 P2 P1 P3 P2

connect approve fail req_service report

slide-7
SLIDE 7

Visual semantics

Sends before corresponding receives. Events on the same process line

execute in order of appearance, from top to bottom.

slide-8
SLIDE 8

Visual order (wysiwyg)

If some event

(send, receive) is higher on the line than another, it comes first.

Sends precede

matching receives.

P1 P3 P2

M1 M2 M3 M4 M5 M6

slide-9
SLIDE 9

Visual order (wysiwyg)

P1 P3 P2

M1 M2 M3 M4 M5 M6

s s s s s r r r r r r s

M1 M2 M3 M4 M5 M6

An events that appear in the process line above the other will precede it in time!

slide-10
SLIDE 10

P2 P1 P3 M1 M2 M3 M4 M5 M6

M1 M2 M3 M4 M5 M6

P1 P2 P3

Causal Order

Rules: order between

  • receive and a later send.
  • two sends from same process.
  • send and corresponding receive.
  • fifo order.
  • Everything that follows by transitive

closure

slide-11
SLIDE 11

P2 P1 P3 M1 M2 M3 M4 M5 M6

M1 M2 M3 M4 M5 M6

P1 P2 P3

Causal Order

Rules: order between

  • receive and a later send.
  • two sends from same process.
  • send and corresponding receive.
  • fifo order.
  • Everything that follows by transitive

closure

slide-12
SLIDE 12

Races: the difference between the visual order and the causal order

M1 M2 M3 M4 M5 M6

P1 P2 P3 s s s s s r r r r r r s

M1 M2 M3 M4 M5 M6

slide-13
SLIDE 13

Races: events can also

  • ccur in reverse order

P1 P3 P2

M1 M2 M3 M4 M5 M6

P1 P3 P2

M1 M2 M3 M4 M5 M6

slide-14
SLIDE 14

Calculating the transitive closure

Structure (E, R). E – Events, R ⊆ E × E. R* The transitive closure. Defined as

follows: a R*b if there is a sequence x1 x2 … xn where a=x1, b=xn, and xi R xi+1 for 1≤i<n.

Complexity: cubic. In our case: quadratic

since every event has 1 or 2 successors).

slide-15
SLIDE 15

Can also deal with time

P1 P2 [2,4] [3,5] [2,3] [7,10]?

Use Difference Bound Matrices (DBMs)

slide-16
SLIDE 16

Put all known constraints, e.g., 2≤e2-e1≤4e2-e1≤4,e1-e2≤-2

P1 P2 [2,4] [3,5] [2,3] [7,10]?

  • 2
  • e4

3

  • 3
  • e3
  • 5
  • 2

e2

  • 4

e1 e4 e3 e2 e1

e1 e3 e2 e4

slide-17
SLIDE 17

Normalize: ei-ej≤l+ej-ek≤m+ei-ek≤n ei-ek≤min(n,l+k)

P1 P2 [2,4] [3,5] [2,3] [7,10]?

  • 2
  • e4

3

  • 3
  • e3
  • 5
  • 2

e2

  • 4

e1 e4 e3 e2 e1

e1 e3 e2 e4

9

slide-18
SLIDE 18

Compare checked limit to normalized table.

P1 P2 [2,4] [3,5] [2,3] [7,10]?

  • 2
  • 5
  • 7

e4 3

  • 3
  • 5

e3 8 5

  • 2

e2 12 9 4 e1 e4 e3 e2 e1

e1 e3 e2 e4

Problem!! OK!!

slide-19
SLIDE 19

Visual concatenation semantics: extend process lines. An execution: infinite or maximal

connect approve fail report Req_service

A C D B Execution: ACACD

connect connect fail fail Req_service report report

Technically: for concatenation: take union of events. For each process Pi, order events of A before events of C. For the path: take limit of union (A U AC U ACA … )

slide-20
SLIDE 20

Visual concatenation semantics: extend process lines. An execution: infinite or maximal

connect approve fail report Req_service

A C D B Execution: ACACD

connect connect fail fail Req_service report report

Note: unordered even if in subsequent HMSC boxes!! More?

slide-21
SLIDE 21

Visual concatenation semantics: extend process lines. An execution: infinite or maximal

connect approve fail report Req_service

A C D B Execution: ACACD

connect connect fail fail Req_service report report

Note: unordered even if in subsequent HMSC boxes!! … and more.

slide-22
SLIDE 22

Star operation over partial order: not necessarily regular (“recognizable”)

P1 P2 Language: At least as many send events as receives in every prefix (Stack Machine Recognizable) s r

slide-23
SLIDE 23

Star operation over partial order: not necessarily regular (“recognizable”)

P1 Language: Even worse… (Not even Stack Machine Recognizable) P1 P1

slide-24
SLIDE 24

Races in HMSCs. Definition

For each HMSC M execution Ex, define

the linearizations according to the visual order

linvis(Ex) and

the linearizations according to the causal order

lincaus(Ex). Extend to all executions: linvis(Ex) and lincaus(Ex).

Always linvis(Ex) ⊆ lincaus(Ex). (Visual order will not

allow exchanging two receives on same process!!)

  • Races

Races : when linvis(Ex) ⊂ lincaus(Ex).

slide-25
SLIDE 25

Similar to Mazurkiewicz Traces

(semi commutation: can exchange receive with next send, but not vice versa).

Alphabet {a,b,c} Independence: aIb, bIc Equivalence classes of words (denoted using representatives): [aabb]=[abba] Regular trace language: can be defined using concatenation, star, union, intersection. Note: [ab]* is not regular (recognizable).

slide-26
SLIDE 26

Other problems… Global decision

P1 P2 P1 P2

+ =?

What if one process will start to behave according to M1 and the other will start according to M2? M1 M2

slide-27
SLIDE 27

Races for HMSCs (intuition only)

Undecidable [MP99]

Translate to language theory of

traces, which are closed w.r.t. commuting certain pairs of letters.

Intuition: moving from visual to

causal semantic introduces more commutations: Two receives on the same process line (from different processes) are dependent on visual and independent on causal order.

Reduction to universality of trace

languages (things are independent with causal semantics).

Independent Language L Independent

slide-28
SLIDE 28

Model checking

Write both specification and system as

  • HMSCs. Check emptiness of

intersection.

Write specification in LTL. Interpret

  • ver the linearizations of the partial
  • rders.

In both cases: undecidable.

slide-29
SLIDE 29

Post Correspondence Problem

List of pairs:

w1:(aab,bb), w2:(ab,bab), … wn:(a,bb). Want to find if there is a set of indices i1, i2, …, ik, such that concatenating the lefthand words and concatenating the righthand words is the same.

Supose we take indices 1, 2, n, 1. We get: lefthand: aab ab a aab righthand: bb bab bb bb

slide-30
SLIDE 30

PCP reduction

P1 P2 P3 P4 P3 P4 P1 P2 P5 P6 P5 P6

a b a a b

P5 P6 P5 P6 P1 P2 P3 P4 P3 P4 P1 P2

w2 b w1 b (aab,bb), (ab,bab),... Word match Letter match w1 w2 b a b

slide-31
SLIDE 31

Some solutions:

The specification HMSCs allows any

additional gaps [MPS98].

Put limit on message queues [Holzmann] Strongly connected communication graph

for each cycle [AY, MP].

This also gives a limit (exponential in number of processes) on needed size of message queues.

slide-32
SLIDE 32

Graph of loop AC:

P1 P2 P3

connect approve fail report Req_service

A C D B

P1 P3 P2

Obtain decidability under the following condition [MP99,AY99]: Every HMSCs cycle covers a strongly connected component in the communication graph: An edge exist from a process Pi to a process Pj if there is a communication from Pi to Pj. Then system finite and regular!

slide-33
SLIDE 33

Problem with describing protocols

s1 t2 t1 s3 s2 P1 P2 P1:snd P1:snd P1:rcv P2:snd P2:rcv

slide-34
SLIDE 34

Problem with describing protocols

P1 P2

slide-35
SLIDE 35

Problem with describing protocols

P1 P2

slide-36
SLIDE 36

Problem with describing protocols

P1 P2

slide-37
SLIDE 37

Problem with describing protocols

P1 P2

slide-38
SLIDE 38

Problem with describing protocols

P1 P2

slide-39
SLIDE 39

Problem with describing protocols

P1 P2

slide-40
SLIDE 40

Solution: Compositional HMSCs

P1 P2 P1 P2

slide-41
SLIDE 41

Even emptiness is undecideable!

(but this HCMSC has strange “executions)

(E1+E2+…+Em)+ (G1+G2+…+Gm)+ F

a a b w3 b a b w2

E3 G2 F

slide-42
SLIDE 42

Left closed CHMSCs

Does not allow unmatched receive

event that is not yet matched by a previous unmatched send.

HCMSC is realizable if every path is

matched.

Can be checked in polynomial time

using a nondeterministic stack machine.

slide-43
SLIDE 43

How to check for realizability?

  • What can go wrong?

1.

More unmatched receives than sends in a prefix.

2.

Overtake: the kth unmatched send before a matched pair, the kth receive after.

3.

The kth unmatched send has name C, the kth unmatched receive has name D.

How to check with a stack

machine for each pair of processes? 1+2: Push a £ for each unmatched send (per message name), pop a £ for each unmatched receive. 3: Guess that it’s a name mismatch upon seeing an unmatched send. Ignore further sends. Pop £ as usual for receives, until corresponding receive

  • ccurs.
slide-44
SLIDE 44

Now we can translate finite state protocols to CHMSCs

Any finite state

protocol can be translated.

Trivial translation:

any transition in finite state graph makes one CHMSC node, with possibly an unmatched message.

This does not give more

information than finite state graph.

Try to optimize: take

some paths.

Break graph into cycle

free paths (e.g., using DFS and back arrows).

Use partial order

reduction (sleep sets) to minimize number of paths.

slide-45
SLIDE 45

P2 P1 P3 M1 M2 M3 M4 M5 M6

Recall our original example

slide-46
SLIDE 46

Nexttime: O p

P2 P1 P3 M1 M2 M3 M4 M5 M6

M1 M2 M3 M4 M5 M6 P1 P2 P3

p p p The logic TLC [APP] over MSCs. Label events with propositions.

slide-47
SLIDE 47

¬O ¬p

P2 P1 P3 M1 M2 M3 M4 M5 M6

M1 M2 M3 M4 M5 M6 P1 P2 P3

p p p p p

slide-48
SLIDE 48

O p

P2 P1 P3 M1 M2 M3 M4 M5 M6

M1 M2 M3 M4 M5 M6 P1 P2 P3

p p p

slide-49
SLIDE 49

P2 P1 P3 M1 M2 M3 M4 M5 M6

p p

M1 M2 M3 M4 M5 M6 P1 P2 P3

Until: pUq p q p p p p p p p p p q q true U q = <>q

slide-50
SLIDE 50

P2 P1 P3 M1 M2 M3 M4 M5 M6

p p

M1 M2 M3 M4 M5 M6 P1 P2 P3

¬(trueU¬p) = p p p p p p p p p p p p p p p p p p p p p p p p p p

slide-51
SLIDE 51

Some specifications

(req --> <> ack) Every request is followed by acknowledge. ¬<>(transA /\ <> (transB /\ <>transA)) Transaction B cannot interfere with transaction A. (beginA --> O (transA U finishA )) The execution of transaction A is not interrupted by any other event.

slide-52
SLIDE 52

connect approve fail report Req_service

HMSC linearizations

slide-53
SLIDE 53

Intuition behind algorithm for Op

2 5 7 3 6 4 8 10 12 11 1 9

M1 M2 M3 M4 M5 M6 P1 P2 P3

2 3 4 5 6 7 8 9 10 1 12 11

  • Aut. with 2 successors relations.

There are two cases:

  • p holds for matching receive.

Then use 2nd successor rel.

  • p holds for successor in proc.

Then wait to see event of same process. Intersect: System autom. (linearizations) Property autom. (of ¬prop) 2 3 4 5 6 7 8 9 10 1 12 11

slide-54
SLIDE 54

Overview

MSC HMSC Finite, one scenario CHMSC Cannot express behavior of some protocols Bounded HMSC Connected communication HMSC Emptiness undecidable Realizable CHMSC Partial order model checking Finding races Checking realizability Undecidable linear model checking

slide-55
SLIDE 55

Conclusions

  • Visual notation have

advantages over textual representation.

  • MSCs is a standard for

describing concurrent interactions.

  • MSCs are based on partial
  • rder semantics.
  • MSCs raise many interesting

research problems, e.g., race condition.

  • Model checking for MSCs is

undecidable [GP,AY].

  • TLC model checking is based
  • n partial order semantics

and is decidable.

  • Some extensions to the MSC

standard are useful, e.g., CHMSCs, LSCs.