1 / 59

Model checking with Message Sequence Charts

Model checking with Message Sequence Charts. Doron Peled Collaborators: R. Alur, E. Elkind, B. Genest, E. Gunter, G. Holzmann, A. Muscholl, Z. Su. Bar Ilan University, Ramat Gan. Topics. Syntax and semantics Checking Race Conditions High Level MSCs Extensions Model Checking. MSCs.

mariko
Télécharger la présentation

Model checking with Message Sequence Charts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Model checking withMessage Sequence Charts Doron Peled Collaborators: R. Alur, E. Elkind, B. Genest, E. Gunter, G. Holzmann, A. Muscholl, Z. Su Bar Ilan University, Ramat Gan

  2. Topics • Syntax and semantics • Checking Race Conditions • High Level MSCs • Extensions • Model Checking

  3. MSCs • An ITU standard notation (Z120). • Visual + Textual forms. • Specifies behaviors of communication protocols. • Existing algorithms + tools.

  4. MSC visual notation P1 P2 P3 M1 M2 M3 M4 M5 M6

  5. msc MSC; inst P1: process Root, P2: process Root, P3: process Root; instance P1; out M1 to P2; in M5 from P2; in M6 from P3; endinstance; instance P2; in M1 from P1; out M2 to P3; out M3 to P3; in M4 from P3; out M5 to P1; endinstance; MSC Textual form instance P3; in M2 from P2; in M3 from P2; out M4 to P2; out M6 to P1; endinstance; endmsc; P1 P2 P3 M1 M2 M3 M4 M5 M6

  6. Partial order semanticsIn fact, there are two possibilities for semantics, which makes it problematic/interesting M1 s r M2 s r P1 P2 P3 M1 M2 M3 s M3 r M4 s M5 M4 M6 r s s M5 M6 r r

  7. HMSCs P1 P2 P3 P1 P2 P3 approve connect P1 P2 P3 P1 P2 P3 fail req_service report

  8. An execution: infinite or maximal sequence of MSCs concatenated A B Execution: ACACD approve connect connect fail report connect fail fail Req_service report report Req_service C D

  9. Visual semantics • Sends before corresponding receives. • Events on the same process line execute in order of appearance, from top to bottom.

  10. Visual order (wysiwyg) M1 s r M2 s P1 P2 P3 r M1 M2 M3 s M3 M4 r M5 s M4 M6 r s s M5 M6 r r

  11. Causal Order:Order only what is controlable P1 P2 P3 M1 • Sends before matching receive. • Receive or sends before sends of same process (M3 and M4). • Two receives on the same process sent from the same process. M2 M3 M4 M5 M6

  12. Causal Order M1 s r M2 s r P1 P2 P3 M1 M2 M3 s M3 r M4 s M5 M4 M6 r s s M5 M6 r r

  13. The problem: Races • The existence of two possible semantics is a source of confusion. • Users may see one semantics as more intuitive or the other. • The discrepancies between the two semantics, causing potentially different order of events, is called “races”.

  14. Races P1 P2 P3 P1 P2 P3 M1 M1 M2 M2 M3 M3 M4 M4 M5 M6 M6 M5 Races: check if every pair of events ordered by the visual order appears in the transitive closure of the causal order.

  15. Calculating the transitive closure • Structure (E, R). • E – Events, R  E  E. • R* The transitive closure. Defined asfollows:a R*b if there is a sequencex1 x2 … xn where a=x1, b=xn,and xi R xi+1 for 1i<n. • Complexity: in general cubic. But in our case: quadratic (every event has 1 or 2 successors).

  16. Causal Order M1 s r M2 s r P1 P2 P3 M1 M2 M3 s M3 r M4 s M5 M4 M6 r s s M5 M6 r r

  17. Visual order (wysiwyg) M1 s r M2 s P1 P2 P3 r M1 M2 M3 s M3 M4 r M5 s M4 M6 r s s M5 M6 r r

  18. Finding races: P1 P2 P3 M1 P1 P2 P3 M1 M2 M2 M3 M3 M4 M5 M4 M6 M5 Rules: order between - receive and a later send. - two sends from same process. - send and corresponding receive. -fifo order. M6 Race: In visual order but not in transitive closure of causal order.

  19. Co-regions Co-regions are boxes around events that explicitly say:allow these events to appear in any order! P1 P2 P3 M1 M2 M3 M4 M5 M6

  20. P1 P2 [2,4] [3,5] [7,10] [2,3] Can also deal with time Use time differencematrices.

  21. Races in HMSCs. Definition For each HMSC M execution Ex, define thelinearizations according to the visual orderlinvis(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). • Races: when linvis(Ex)  lincaus(Ex).

  22. Mazurkiewicz Traces Alphabet {a,b,c} Independence: aIb, bIc Equivalence classes of words (denoted usingrepresentatives): aabb and abba equivalent[aabb ]=[abba ] Regular trace language: can be defined usingconcatenation, star, union, intersection. Note: [ab ]* is not recognizable (by automata, and [abc ]* is not recognizable by stack machine). In general [L] for a regular language L is not necessarily regular or context-free. Traces can be concatenated: [vw]=[v][w]. Thus, [ab ][ab ]=[abab ]

  23. Semi-traces • Similar to traces, but sometimes can letters can commute only in one direction. • Useful for describing communication systems: can commute receive with a later send between the same pair of processes, but not necessarily send with a later receive: sssrrrssrsrrsrssrrsrsrsr -/->rssrsr • A message sequence chart can be modeled as a semi-trace.

  24. P1 P2 P3 M1 M2 A M3 P1 P2 P3 M4 M5 B M6 Concatenation of MSCs • Extending the lines of the process to include all messages. • When we concatenate MSC A before MSC B, it does not mean that all events of A precede all the events of B.

  25. Concatenation of MSCs • Extending the lines of the process to include all messages. • When we concatenate MSC A before MSC B, it does not mean that all events of A precede all the events of B. • Receiving M2 may occur after sending M4. • Can simply concatenate the corresponding semi-traces! P1 P2 P3 M1 M2 M3 A; B M4 M5 M6

  26. P1 P2 P3 connect fail report connect fail report connect approve Concatenation A B P1 P2 P3 P1 P2 P3 connect approve P1 P2 P3 P1 P2 P3 fail req_service report Execution: concatenation of a maximal path in the HMSC. Concatenation of MSCs  Concatenation of semi-traces. C D

  27. P1 P2 Other problems…Global decision M1 M2 P1 P2 + =? What if one process will start to behave according to M1 and the other will start according to M2? Some decision procedures for this problem + MSC restrictions

  28. Races for HMSCs Undecidable [MP99] • 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. • Build regular L where each letter becomes an MSC with one message. • Universality of semi-trace languages. Is [L]=* is similarly undecidable. a c b aIc, bIc in Visual order. All letters/events are independent in causal semantics.

  29. The case in the middle:No HMSC graph, but multiple MSCs [EGP07] • We call a collection of finite MSCs an ensemble. This is usually what is given by engineers. • A polynomial algorithm for checking races. • NP-Complete if we allow co-regions. • But, to be race free, one may need exponential number of MSCs (in size of a single MSC).

  30. Calculating the “discord” [EGPS07] • The “discord” is a measure of the possible deviation of the actual execution order from what seems to be the order according to the HMSC. • This discrepancy is similar to “races” and stems from the fact that in concatenation, an event from earlier MSC can precede one from later MSC. • Intuitively: the discord tell the designer that (s)he may think that the message order is X, but at worst it can be Y. • Use “Allen’s logic” to describe order. A A A B B B AoB (Aoverlaps B) AdB (Aduring B) AbB (A before B)

  31. Calculate from HMSC the order between pairs of messages. The Vertical lines: the two messages in focus. Dashed lines: chains of messages, i.e.,s r s …s r where adjacent r and s are from same process. Faint lines: more chains of messages that can be inferred from situation. These are 4 out of 22 cases.

  32. The discord tells us what is the maximal “inversion” between the message order according to the HMSC structure, and actual order M2 cannot appear completely after M4; at worst, it can start after M4 has started but before it ended, and finish after M4 finishes. In Allen’s logic, M4oM2. The discord is, informally, a mesasure of this worst situation. Calculating the discord for two messages: Co-NP complete in number of processes and size of HMSC. P1 P2 P3 M1 M2 A P1 P2 P3 M4 M5 B M2 M4 M6

  33. Model checking • Write both specification and system as HMSCs, or • Write specification in LTL. Interpret over the linearizations of the partial orders. • In both cases: undecidable. • We’ll show the intersection case. For the LTL case: encode the linearizations of one of the HMSCs with LTL: for each MSC node, only one linearization is necessary.

  34. Post Correspondence Problem • List of pairs:w1:(aab,aa), w2:(aba,ab), … wn:(a,bb).Want to find if we find a set of indexesi1, i2, …, ik, such that concatenatingthe lefthand words and concatenatingthe righthand words is the same. • Supose we take indexes 1, 2, n, 1. We get: • lefthand: aab aba a aab • righthand: aa ab bb aa

  35. P5 P6 P5 P6 P1 P2 P5 P6 P5 P6 PCP reduction a b P1 P2 P1 P2 P1 P2 a b a a b b b b P3 P4 P3 P4 P3 P4 P3 P4 w2 w1 w2 w1

  36. The communication structure of an MSC (HMSC) P1 P2 P3 M1 M2 P1 P2 P3 M3 An edge exist from a process Pi to a process Pj exists if there is a communication from Pi to Pj.

  37. Some solutions: • Obtain decidability under the following condition [MP99,AY99]:Every HMSCs cycle covers a strongly connected component of the communication graph. An edge exist from a process Pi to a process Pj if there is a communication from Pi to Pj. • Pattern matching: The specification HMSCs allows any additional gaps [MPS98]. • Put limit on message queues [Holzmann].

  38. Problem with describing protocols P1 P2 s1 t1 P1:snd s2 P2:snd P2:rcv P1:snd t2 P1:rcv s3

  39. Problem with describing protocols P1 P2

  40. Problem with describing protocols P1 P2

  41. Problem with describing protocols P1 P2

  42. Problem with describing protocols P1 P2

  43. Problem with describing protocols P1 P2

  44. Problem with describing protocols P1 P2

  45. P1 P2 Solution: Compositional HMSCs P1 P2

  46. a b w3 a Even emptiness is undecideable! (E1+E2+…+Em)+ (G1+G2+…+Gm)+ F b b w2 a E3 G2 F

  47. Left closed HCMSCs • 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.

  48. What can go wrong? More unmatched receives than sends. The k th unmatched send before a mathced pair, the k th receive after. The k th unmatched send has name C, the k th 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, 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 occurs. How to check for realizability?

  49. Any finite state protocol can be translated. Trivial translation: any transition in finite state graph makes one HCMSC node, with possibly an unmatched message. This does not give more information than finite state graph. Try to optimize: take some paths. Now we can translate finite state protocols to HCMSCs

  50. The logic TLC [APP] over MSCs. Label events with propositions. P1 P2 P3 M1 Nexttime: O p P1 P2 P3 M2 M1 p M2 M3 p M3 M4 M4 M5 M6 M5 M6 p Interpret over any execution path of the MSCs (Partial order logic!)Not over the linearizations of the executions.

More Related