MASARYK UNIVERSITY FACULTY OF INFORMATICS }w¤§¨!"#$%&123456789@ACDEFGHIPQRS`ye| Time Extension of Message Sequence Chart BACHELOR THESIS L'uboˇs Korenˇciak Brno, Spring 2009 Declaration Hereby I declare, that this paper is my original authorial work, which I have worked out by my own. All sources, references and literature used or excerpted during elaboration of this work are properly cited and listed in complete reference to the due source. In Brno, May 22, 2009 L'uboˇs Korenˇciak Advisor: RNDr. Vojtˇech ˇReh´ak, Ph.D. iii Acknowledgement I would like to express my deepest gratitude to my advisor RNDr. Vojtˇech ˇReh´ak, Ph.D., for his helpful comments, suggestions and patience. Next I would like to thank my family for its support through my life. Finally I thank Martin Chmel´ik, Martin Kˇriv´anek and Ondˇrej Kocian for fruitful discussions. v Abstract Message sequence charts (MSC) is a graphical and textual formalism suitable for specifying distributed communication. It consists of the MSC and a High-level MSC (HMSC). The formalism incorporates the possibility of specifying time in designed systems. There arise severe problems regarding timing constraints in MSC, such as computation of minimal network. First attempts to solve the problems using various approaches have been presented. In this thesis, we analyze different approaches to time extension of MSC. As most suitable appears to be the approach using labeled partially ordered sets. An extension to this approach is provided to handle computation of minimal network in MSC formalism with coregions and constraints in HMSC. Restriction to proper constraint specification is given, which rules out ambiguous and erroneous constraint specifications. Algorithm pseudocodes for checking proper time constraints are provided. vii Keywords Message Sequence Charts, Message Sequence Graph, timing consistency, tightening, minimal network ix Contents 1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 2 Preliminaries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.1 Message Sequence Chart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.2 High-level Message Sequence Chart . . . . . . . . . . . . . . . . . . . . . . . . 6 2.3 Message Sequence Graph . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3 Introduction to the Problematics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.1 Timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.2 Time Intervals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 3.3 Definition of MSC and MSG with Timing Constraints . . . . . . . . . . . . . . 11 3.4 Problems on MSCs with Timing Constraints . . . . . . . . . . . . . . . . . . . . 12 4 Research Through Presented Works . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.1 Automata Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 4.2 Petri Net Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.3 Lposet Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 4.4 Linear Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 4.5 Choosing the Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 5 Proper Time Constraints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.1 Definitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 5.2 Checking Algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 6 Tightening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.1 Old Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 6.2 New Operators . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 6.3 Tightening of MSC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 7 Tightening of MSG . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 7.1 Main Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33 7.2 Loops . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34 8 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 1 Chapter 1 Introduction Message Sequence Chart (MSC) is an appealing formalism for specifying distributed communication, especially network protocols. MSCs are formally defined in ITU standard Z.120 [9]. They consist of equivalent graphical and textual notation. MSC is used in the early phases of protocol design process. Many works and approaches how to detect serious design faults in distributed systems specified in MSC formalism have been presented . These faults include deadlock and livelock. There are already developed tools which support automated detection of these faults, such as MSCan [16], uBet [20] or SCStudio [18]. The programs differ by various approaches to the properties of MSCs and by ability to design more complex systems. The SCStuio is program which is being developed at Faculty of Informatics, Masaryk University. So far it can be used to verify some important MSC properties such as livelock, deadlock and trace race conditions. But it lacks the option of specifying time in designed systems, which is important in many protocols. In standard Z.120 there are specified options how to include time in MSC. After specifying time there rise severe problems concerning time in MSC. There have been presented severe approaches how to address the problem of extension of time to MSC and problems regarding time in MSC in the literature . This thesis aims to analyze the different approaches and find the answer to problems regarding time, especially in the context of SCStudio. The thesis is structured as follows. We first formally define MSCs, then specify criteria for finding ideal approach. Then we analyze already presented papers to handle time in MSC and pick the most suitable approach. Restriction to proper time constraints is given, which rules out ambiguous and erroneous timing constraints specifications. Finally extensions to the approach are provided and suggestions for next research are given. 3 Chapter 2 Preliminaries According to ITU recommendation Z.120 standard [9], an MSC formalism consists of simple MSC and highlevel Message Sequence Charts (HMSC). Both, MSC and HMSC, have textual and graphical notation. Instead of HMSC we use semantically equivalent MSG. Through this thesis N will denote natural numbers with zero, R real numbers and R+ nonnegative real numbers. 2.1 Message Sequence Chart An MSC consists of set of processes depicted as vertical lines, set of events on process lines and asynchronous communication depicted as arrows connecting two events. Event belongs to exactly one process and exactly one arrow. Set of events is partitioned into send and receive events. Arrow leaves from a send event and aims to a receive event. Send event is always ordered before its corresponding receive event and all process lines depict total order on their events except events in coregion. Coregions are sections on the process lines where the events are not ordered. Coregion is depicted as a rectangle on process line and events in the coregion are events on the rectangle. If one wants to enforce additional ordering of events in coregion, connections can be used. Connection a is dashed arrow leaving from the preceding event and aiming to the subsequent event. The next two definitions are used from [8,19]. Definition 1. An MSC (with coregions and connections) is defined as a tuple (E, <, P, , P, M, C, G) where * E is a set of events; * < is a partial ordering on E called visual order; * P is a finite set of processes; * : E {s, r} is a labeling function dividing events into send, receive; * P : E P is a mapping that associates each event with a process; * M (-1(s) × -1(r)) is a bijective mapping, relating every send with a unique receive, such that for any (e, f) M we have P(e) = P(f) a process cannot send messages to itself; 5 2. PRELIMINARIES * C is a set of pairwise disjoint coregions where a coregion (say C C) is defined as a subset of events on some process, i.e. C P-1(p) where p P; * G CC C × C is a partial ordering on events within coregions and is called connections. Visual order < is defined as the reflexive and transitive closure of M G pP
x b . If we want to tighten any interval kz, rz where z {1, 2, . . . , 2y + 3} we get kz, rz - kz, rz x - r1 - r2 - - rz-1 - rz+1 - - r2y-3, - k1 - k2 - - kz-1 - kz+1 - - k2y-3 . 35 7. TIGHTENING OF MSG 1, 2 4, 16 4, 5 1, 5 0, 0 0, 0 1, 5 10, 2010, 20 1, 2 4, 16 4, 5 1, 5 0, 0 0, 0 10, 20 1, 2 4, 5 0, 0 0, 0 1, 5 1, 2 0, 0 0, 0 4, 5 10, 20 1, 2 0, 0 0, 0 4, 5 3, 5 10, 12 10, 20 4, 5 10, 20 4, 5 1, 2 4, 16 1, 2 4, 5 1, 2 4, 16 10, 20 3, 5 4, 15 4, 15 1, 2 4, 5 0, 0, 0, 11 0, 11 0, 11 0, 11 Figure 7.4: Example of tightening of an MSG Let kz = x - r1 - r2 - - rz-1 - rz+1 - - r2y-3 = x - d - b - d - b - d - - d. Since we have y + 1 or y values of b kz x - b.(y + 1) x - by < 0 and we get kz, sz kz, ) = kz, sz , because kz < 0. We have chosen arbitrary interval in a run, that is why we cannot tighten any interval in run. Since we cannot tighten one run, we cannot tighten loop. For unions of the intervals we just do the above for every choice of simple intervals S, T and the interval x, ) U. From the above argument it follows that we cannot tighten any choice of the simple intervals from S, T. When we union all the results from tightening, all values for S, T will appear in new S, T. Thus we do not have to do any work regarding tightening for every choice of simple intervals from S, T and U \ x, ). From that follows that we cannot tighten constraints S, T by U. 36 Chapter 8 Conclusion In this thesis we have addressed the formal background of the time extension of MSC. We have defined MSC and MSG with timing constraints and problems regarding time and MSC, such as timing consistency and finding minimal networks. We have studied published results to this problematics without finding a complete solution. Lposet approach has been chosen as the closest approach to our setting. Then the time constraints in MSC to proper time constraints, i.e. constraint specifications cleaned of erroneous and ambiguous constraints, have been restricted. We have also introduced algorithms and algorithm outlines for checking whether all constraints in MSG are proper. Then we extended the lposet approach to be strong enough to compute solutions to all previously specified problems. We have also provided outlines of algorithms for achieving this. It remains to finish the algorithms and implement them into our developed tool SCStudio. 37 Bibliography [1] S. Akshay, M. Mukund, and K.N. Kumar. Checking Coverage for Infinite Collections of Timed Scenarios. Lecture Notes in Computer Science, 4703:181, 2007. [2] R. Alur, K. Etessami, and M. Yannakakis. Realizability and verification of MSC graphs. Theoretical Computer Science, 331(1):97114, 2005. [3] R. Alur, G.J. Holzmann, and D. Peled. An Analyzer for Message Sequence Charts. In TACAS'96, LNCS, pages 3548. Springer, 1996. [4] R. Alur and M. Yannakakis. Model checking of message sequence charts. Lecture Notes in Computer Science, pages 114129, 1999. [5] H. Ben-Abdallah and S. Leue. Expressing and analyzing timing constraints in message sequence chart specifications. Department of ElectricalComputer Engineering, University of Waterloo, 1997. [6] P. Chandrasekaran and M. Mukund. Adding Time to Scenarios. Next Generation Design and Verification Methodologies for Distributed Embedded Control Systems., page 83, 2007. [7] R. Dechter, I. Meiri, and J. Pearl. Temporal constraint networks. In Knowledge Representation, volume 49, pages 6195. MIT Press, 1992. [8] E. Elkind, B. Genest, and D. Peled. Detecting Races in Ensembles of Message Sequence Charts. In TACAS'07, volume 4424 of LNCS, pages 420434. Springer, 2007. [9] ITU Telecommunication Standardization Sector Study group 17. ITU recommandation Z.120, Message Sequence Charts (MSC), 2004. [10] J.G. Henriksen, M. Mukund, K.N. Kumar, and PS Thiagarajan. Towards a theory of regular MSC languages. BRICS, Computer Science Department, University of Aarhus, 1999. [11] T.H. Kim and S.D. Cha. Timed High-Level Message Sequence Charts for Real-Time System Design. Lecture Notes in Computer Science, 4320:82, 2006. [12] K.G. Larsen, P. Pettersson, and W. Yi. Uppaal in a Nutshell. International Journal on Software Tools for Technology Transfer (STTT), 1(1):134152, 1997. 39 8. CONCLUSION [13] X. Li and J. Lilius. Timing analysis of message sequence charts. Turku Centre for Computer Science, 1999. [14] Xuandong Li, Bu Lei, Jun Hu, Jianhua Zhao, Tao Zhang, and Guoliang Zheng. Scenariobased timing consistency checking for time petri nets. In Elie Najm, Jean-Franc¸ois Pradat-Peyre, and V´eronique Donzeau-Gouge, editors, FORTE, volume 4229 of Lecture Notes in Computer Science, pages 388403. Springer, 2006. [15] P. Lucas. Timed semantics of message sequence charts based on timed automata. Electronic Notes in Theoretical Computer Science, 65(6):160179, 2002. [16] MSCan Message Sequence Charts analyzer. http://aprove.informatik. rwth-aachen.de/~kern. [Online; accessed 18-April-2009]. [17] A. Muscholl and D. Peled. Message Sequence Graphs and Decision Problems on Mazurkiewicz Traces. In MFCS'99, volume 1672 of LNCS, pages 8191. Springer, 1999. [18] SCStudio Sequence Chart Studio. http://scstudio.sourceforge.net/, 2009. [Online; accessed 18-April-2009]. [19] P. Slov´ak. Decidable Race Conditions in High-Level Message Sequence Charts. Bachelor thesis, Faculty of Informatics, Masaryk University, Brno, 2008. [20] UBET (formaly named MSC/POGA.). http://cm.bell-labs.com/cm/cs/what/ ubet/. [Online; accessed 18-April-2009]. [21] T. Zheng and F. Khendek. Time consistency of MSC-2000 specifications. Computer Networks, 42(3):303322, 2003. 40