30
SPIN Verification System The Model Checker SPIN By Gerard J. Holzmann Comp 587 – 12/2/09 Eduardo Borjas – Omer Azmon

SPIN Verification System

  • Upload
    gada

  • View
    55

  • Download
    0

Embed Size (px)

DESCRIPTION

SPIN Verification System. The Model Checker SPIN By Gerard J. Holzmann Comp 587 – 12/2/09 Eduardo Borjas – Omer Azmon. ☐. Overview. Example Live Demo Conclusion Q & A. Problem Solution Applications Structure. ☐. Problem. ☐. Problem: Today’s Problem With Design. - PowerPoint PPT Presentation

Citation preview

Page 1: SPIN Verification System

SPIN Verification System

The Model Checker SPIN By Gerard J. Holzmann

Comp 587 – 12/2/09Eduardo Borjas – Omer Azmon ☐

Page 2: SPIN Verification System

Overview

ProblemSolutionApplicationsStructure

ExampleLive DemoConclusionQ & A

Page 3: SPIN Verification System

Problem

Page 4: SPIN Verification System

Problem: Today’s Problem With Design“Whether we like it or not, we often design software either by trial and error or by duplicating and modifying a piece of code that does something similar to what we want. This works fine for small applications, but fails miserably for large design projects or for critical code.”

-Gerard J. Holzmann

Page 5: SPIN Verification System

Problem: Circular Blocking

Page 6: SPIN Verification System

Problem: Deadly Embrace

Get B

Get A

Rel A

Rel B

Rel B

Rel A

Get A

Get B

*Rel = Release ☐

Page 7: SPIN Verification System

Problem: Design Flaws

Deadlock

LivelockStarvation

OverspecificationUnused code

UnderspecificationNot all states are expected

Assumptions about SpeedLogic vs. real world

Page 8: SPIN Verification System

Problem: Distributed Process Software

TestingComplexity

Scale

ImpracticalEquipment availabilityRegression testing

TimeTiming in asynchronous processesTesting all instances

Criticality

Page 9: SPIN Verification System

Solution

Page 10: SPIN Verification System

Solution: SPIN“SPIN is an efficient verification system for models of distributed software systems”

SPIN Focuses on Process Interactions

Focus on Proving CorrectnessThe act of proving the correctness of an algorithm using formal methods of mathematics

Page 11: SPIN Verification System

Solution: SPINSPIN Aims To Provide the Following:1) An intuitive, program-like notation for

specifying design choices unambiguously, without implementation detail.

2) A powerful, concise notation for expressing general correctness requirements.

3) A methodology for establishing the logical consistency of the design choices from 1) and the matching correctness requirements from 2).

Page 12: SPIN Verification System

Solution: SPINOther Facts

SPIN Was Awarded the System Software Award by the ACM (2002)

Other award winners include UNIX, TeX, Smalltalk, TCP/IP, and Tcl/Tk

Tools Can Transfer Java or C Programs Into SPIN Models

Used By NASA, Bell Labs, and Lucent

Currently Taught at Caltech (CS 118, 119a-b, and 116)

Page 13: SPIN Verification System

Applications

Page 14: SPIN Verification System

ApplicationsTraditional

Theoretical StudiesEmpirical Studies (Search and Storage)

PracticalFlood Control (Computer Management Group)Mission Critical Software (NASA)Telephone Exchange (Bell Labs & Lucent)Packet SwitchingRailway Safety (Ansaldo and IRST)Client Server Applications

Page 15: SPIN Verification System

ApplicationsPractical

Process SchedulingLeader ElectionFlow ControlMultithreaded Programs

Page 16: SPIN Verification System

Structure

Page 17: SPIN Verification System

Structure: SPINSPIN is Broken Into Two Parts:

Design Specification (PROMELA)Correctness Claims (Linear Temporal Logic)

SPIN = Simple Promela INterpreter

XSPIN Front-End

PROMELA Parser

LTL Parser &

Translator

1. Syntax Error

Reports

2. Interactive Simulation

3. Verifier

Generator

Optimized Model Checker

Executable On-The-

Fly Verifier

Counter-Examples

Page 18: SPIN Verification System

Structure: PROMELA

Specification Language (Design)

PROtocol MEta Language

One or More User-Defined Process Templates

proctype definitionEach template defines the behavior of a processA running process can instantiate another process

Page 19: SPIN Verification System

Structure: PROMELA

active proctype main()

{

printf("hello world\n")

}

Page 20: SPIN Verification System

Structure: Linear Temporal Logic

LTL Is An Extension of Propositional and Predicate Logic to Temporal Claims

SPIN Verification Relies on LTL to Make Claims About Models

Just like Symbolic Logic, LTL Can Be Isomophically Converted Into Finite State Diagrams Using Büchi Formulae

Page 21: SPIN Verification System

Structure: LTL Formulae(Frequently Used)

Formula Pronounced Type/Template

☐p always p invariance

♢p eventually p guarantee

p ♢q p implies eventually q response

p q U r p implies q until r precedence

☐♢p always eventually p recurrence (progress)

♢☐p eventually always p stability (non-progress)

♢p ♢q eventually p implies eventually q correlation

Page 22: SPIN Verification System

Example

Page 23: SPIN Verification System

Example: Peterson’s Mutual Exclusion (Critical Section)

Algorithm

So S5

S1

flagme = 1

S2

turn= me flagother == 0 || turn == other

S3

flagother != 0 && turn == me

flagme = 0

S4Critical Section

Page 24: SPIN Verification System

Example: Peterson’s Mutual Exclusion (Critical Section)

Algorithmbool turn, flag[2];

active [2] proctype user()

{

again:

flag[_pid] = 1;

turn = _pid;

(flag[1 - _pid] == 0 || turn == 1 -_pid);

/* Critical Section */

flag[_pid] = 0;

goto again;

}

SoS5

S1

flagme = 1

S2

turn= me flagother == 0 || turn == other

S3

flagother != 0 && turn == me

flagme = 0

S4Critical

Section

Page 25: SPIN Verification System

Live Demo

Page 26: SPIN Verification System

Example: Peterson’s Mutual Exclusion (Critical Section) Algorithm

bool turn, flag[2];

byte ncrit;

active [2] proctype user()

{

assert(_pid == 0 || __pid == 1);

again:

flag[_pid] = 1;

turn = _pid;

(flag[1 - _pid] == 0 || turn == 1 - _pid);

ncrit++; assert(ncrit == 1); /* critical section */ ncrit--;

flag[_pid] = 0;

goto again;

}

Page 27: SPIN Verification System

Conclusion

Page 28: SPIN Verification System

ConclusionProblem

For complex problems, did the design actually cover all of our bases?How can I test distributed software process models efficiently and cost-effectively?

SolutionSPIN formally proves temporal models mathematicallyEasy to use

Page 29: SPIN Verification System

InformationHolzmann, G. J. (2009). Retrieved from Spin - Formal Verification: http://www.spinroot.com

Holzmann, G. J. (1997). The Model Checker SPIN. IEEE TRANSACTIONS ON SOFTWARE ENGINEERING, 23 (5).

Holzmann, G. J. (2006). The Spin Model Checker. Troy, NY: Addison Wesley.

Cimatti, A., Giunchiglia, F., et al. Model Checking Safety Critical Software with SPIN: an Application to a Railway Interlocking System.

Page 30: SPIN Verification System

Questions & Answers

Comp 587 – 12/2/09Eduardo Borjas – Omer Azmon

Thank You!☐