250 likes | 434 Views
Internals of SPIN Model Checker by Amin Alipour Software Design Lab malipour@mtu.edu. Outline. Introduction to SPIN Reachability Analysis of SPIN Assertions Non-progress Cycles Acceptance Cycles SPIN Validator Internals. SPIN. Model chcking:
E N D
Internals of SPIN Model Checker by Amin Alipour Software Design Lab malipour@mtu.edu
Outline • Introduction to SPIN • Reachability Analysis of SPIN • Assertions • Non-progress Cycles • Acceptance Cycles • SPIN Validator Internals
SPIN • Model chcking: • [Clarke & Emerson 1981]: “Model checking is an automated technique that, given a finite-state model of a system and a logical property, systematically checks whether this property holds for (a given initial state in) that model.” • It is a model checker. • It uses explicit state enumeration for model checking.
How SPIN store the states • Exhaustive • Keeping whole states in memory • Supertrace • Using a big memory and a hash function to map each state to a bit in memory.
Reachability Analysis Algorithms • A reachability analysis algorithms given a model of a program and a property to verify, must verify the property in program. • Properties could be: • Assertions of states • Progress Property • Non-Progress Property
Verifying Non-Progress • Consider that a state stands for Progress P. • It should be verified that every traces must include P. • The algorithm should ensure that there is no cycle without P.
Detecting Non-Progress Cycle in SPIN • If during state enumeration it reaches state in W, it is a cycle. • SPIN uses a demon process as follows: • When magic =1, all transitions from P is disabled.
Non-Progress Cycle Detection-Example • The algorithm guarantees that if any non-progress cycle exists, at least one of them will be detected. • The algorithm incur twice memory and time requirement.
Acceptance Cycles • Here we want to verify that a state (or set of states) is not infinitely often enabled. It is called acceptance states. • We need to detect cycles include the acceptance states.
Detection of Acceptance Cycles • SPIN maintains another copy of A in C. • When an acceptance state S wants to move from W to A (all of its successors have been explored). C restarts the search and looks if there is any cycle that includes S. If yes, SPIN declares an failure.
Checking Temporal Claims • Right after generation of a new state , SPIN enforces the temporal claim transitions. If the transition cannot be made, it is a violation of temporal property and it finishes the search. Otherwise it adds new state(s) to the state space.
Validator Corresponding Files • pangen1.c • pangen1.h • pangen2.h • pangen2.c • pangen3.c • pangen3.h • pangen4.c • pangen5.c
SPIN Validator • Big Picture
Reference • G J Holzmann Design and Validation of Computer Protocols. Prentice-Hall, 1991
Further Readings • Lee, D. and Yannakakis, M. Testing Finite-State Machines: State Identification and Verification. IEEE Trans. Computers. 43, 3 (Mar. 1994), 306-320. • Yannakakis, M. . Testing finite state machines. In Proceedings of the Twenty-Third Annual ACM Symposium on theory of Computing (New Orleans, Louisiana, United States, May 05 - 08, 1991). STOC '91. • M Yannakakis, D Lee. Testing Finite State Machines: Fault Detection. Journal of Computer and System Sciences, 1995. • GJ Holzmann, Design and validation of protocols: a tutorial, Computer Networks and ISDN Systems, 1993. • Lee, D.; Yannakakis, M. Principles and methods of testing finite state machines-a survey , Proceedings of the IEEE , vol.84, no.8, pp.1090-1123, Aug 1996.
Petrenko, A. “Fault Model-Driven Test Derivation from Finite State Models: Annotated Bibliography”. In Modeling and Verification of Parallel Processes, F. Cassez, C. Jard, B. Rozoy, and M. D. Ryan, Eds. Lecture Notes In Computer Science, vol. 2067. Springer-Verlag New York, New York, NY, 196-205. http://www.springerlink.com/content/fnpm8c6wt52q28kj/