



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




ECE 598: Modeling and Verification of Real-time and Hybrid Systems Fall 2008
Prof. Sayan Mitra Scribe: John Sartori
How to model a reactive system? We will study the Input/Output Automation (IOA) model which is used for modelling and verifying reactive systems. It has been extensively used for dis- tributed (and concurrent) systems as well. In this framework, we can specify and prove properties about relative ordering of events but we cannot explicitly talk about time, and hence about dif- ferential equations. The hybrid I/O automata framework which we study later extends IOA with notions for describing timing and continuous evolution.
A concurrent program consists of a set of processes^1 that can be executed in parallel. Each process executes a sequence of statements. Concurrent programs in which the processes do not interact are not particularly interesting and we will not consider them any further. Concurrent programs communicate either through (i) shared memory, or (ii) by passing messages.
Consider (see, Figure 1) a simple model of a concurrent program for mutual exclusion in which the processes communicate through a single shared memory. The goal of this program is to ensure that (a) no two participating processes enter the critical section (C) simultaneously, and (b) any process that attempts to enter the critical section, eventually does get the opportunity. One simple algorithm that may be used to ensure mutual exclusion only allows a process to access the critical section when the value of the shared variable turn equals zero. Thus, an attempt to access the critical section consists of checking the value of turn and proceeding only if the value is zero. To control access to the critical section, the value of turn should be set to a nonzero value on a successful attempt and returned to zero upon leaving the critical section. Note that in order to ensure true exclusion, the read and update of turn should be atomic. Many computer systems provide special instructions such as test-and-set [TAS] for this purpose.
Input/Output Automaton [LT89] is a framework for modeling concurrent and distributed discrete event systems. Unlike traditional models of computation (e.g., finite state machines, TMs) which compute some function of the input and then halt, I/O Automata can model reactive systems which continuously receive input from and react to its environment. Although I/O automata can be used to model synchronous systems, they are best suited for modeling systems in which com- ponents operate asynchronously. Each component of a system is modeled as an I/O automaton,
(^1) also sometimes called agents, nodes, or threads
turn
try (^0)
check 0
turn (^) = 0
check 0
turn (^6) = 0
done 0
exit 0
try (^1)
check 1
turn (^) = 1
check 1
turn (^6) = 1
done 1
exit
1
Figure 1: Simple mutual exclusion.
which is essentially a (possibly infinite state) automaton with an action labeling each transition. The overall system model is obtained as the parallel composition of a set of interacting automata. A fundamental assumption in this framework is that each action is controlled by at most one automaton.
Definition 1. An input/ output automaton (IOA) A is a 5-tuple 〈Q, Q 0 , A, D, R〉, where
(a) Q is a set of states, Q 0 ⊆ Q is a set of start states,
(b) A is a set of actions, partitioned into input I, output O, and internal H actions. L = O ∪ H is the set of local actions. E = O ∪ I is the set of external actions. The partitioned sets are disjoint, such that A = I ∪ O ∪ H
(c) D ⊆ Q × A × Q is a set of discrete transitions. Intuitively, this means that each member of D is a transition from one state in Q to another, triggered by an action in A.
(d) R ⊆ L × L is an equivalence relation on L.
In addition A must satisfy the following input enabling property:
E0 (input action enabling) For every state q ∈ Q and every input action a ∈ I, there exits q′^ ∈ Q such that (q, a, q′) ∈ D.
Returning to the mutual exclusion example, we can define the set of states for n processes and their shared memory value as: Q = {R, N, C, E}n^ × { 0 , 1 , ..., n − 1 } and the set of start states as: Q 0 = {R}n, 0
Index: type = [0 ... n ]
automaton simpleMutex( const i:Index)
shared variables turn: Index
variables pc: {R, N, C, E} := R
signature internal try, check, done, exit
transitions internal try(i) pre pc = R eff pc := N internal check(i) pre pc = N eff if turn = i then pc := C else pc := N fi internal done(i) pre pc = C eff pc := E turn := turn + 1 mod n internal exit(i) pre pc = E eff pc := R
Figure 2: Process for simple mutual exclusion.
planneri plannerj
fifoChannel(i, j)
fifoChannel(j, i)
sendij recvij
recvji sendji
Figure 3: FIFO Channel.
Index: type = [0 ... n ]
automaton fifoChannel( const i,j:Index) where i 6 = j
variables buffer: Queue[R ] := λ
signature input send(i,j, x:R) output receive(i,j, x:R)
transitions input send(i,j, x) pre true eff buffer := append(buffer, x) internal receive(i,j, x) pre buffer.head = x eff buffer = buffer.tail
automaton planner( const i:Index) variables x: R initially arbitrary xt: R := x T: Array[Index, R ] initially empty signature input receive(j:Index, i, m:R) output send(i, j:Index, m:R), update(i, t:R) transitions input receive(j,i,m) eff T[j ] := m; xt := f(x,T) output send(i,j,m) pre x = m ∧ ... eff output update(i,t) pre xt = t ∧ ... eff
Figure 4: A FIFO Channel and a sending process.
Definition 2. A pair of I/O automata A 1 and A 2 are compatible if, for all i, j ∈ { 1 , 2 }, i 6 = j, implies
The first compatibility condition specifies that the actions of one automaton cannot be internal actions on another automaton. The second condition specifies that only one automaton can be responsible for controlling an output.
Definition 3. Given a pair of compatible I/O Automata A 1 and A 2 their composition is denoted by A 1 ‖A 2 , and is defined as 〈Q, Q 0 , A, D, R〉, where
(a) Q = Q 1 × Q 2 , Q 0 = Q 10 × Q 20 ,
(b) A = A 1 ∪ A 2
(c) (q 1 , q 2 ) a → (q′ 1 , q 2 ′) iff if a ∈ Ai then qi a → q i′ otherwise q′ i = qi.
(d) R = R 1 ∪ R 2.
Note that the Input actions of the composition include only the inputs from the individual com- ponents that are not also outputs from other components.
Theorem 1. If A 1 and A 2 are compatible I/O Automata then A = A 1 ‖A 2 is also an I/O Automaton.
Proof. First we check that HA, IA and OA are disjoint. This follows from compatibility. Then, it suffices to check that E0 holds. Let us fix (q 1 , q 2 ) ∈ QA and a ∈ IA = I 1 ∪ I 2 \ (O 1 ∪ O 2 ). Suppose a ∈ I 1 and a /∈ A 2 , then from E0 of A 1 we know that there exists q 1 ′ ∈ Q 1 such that q 1 →a q′ 1. Thus, (q 1 , q 2 ) →a (q′ 1 , q 2 ) is a valid transition in DA. The other case is analogous.
Let Index = { 1 , 2 , 3 } Let A be the composed automaton:
A ∆ = ‖i∈Indexplanner(i)‖i,j∈Index,i 6 =j fifoChannel(i, j).
It is easy to check that the above automaton is well defined, that is, all the automata are compatible. We refer to the individual state components using the (.) notation. E.g., for a state q ∈ QA, q.fifoChannel(1, 3).buffer denotes the first element in the buffer of the FIFO channel between 1 and