
P1: IML/FFX P2: IML/FFX QC: IML/FFX T1: IML
MOBK015-04 MOBK015-Lynch.cls April 1, 2006 17:45
26 THEORY OF TIMED I/O AUTOMATA
type Index = enumeration of p1,p2,p3,p4
type PcValue = enumeration of rem, test, set, check,
leavetry, crit, reset, leaveexit
automaton FischerME(u_set, l_check: Real)
where u_set ≥ 0 ∧ l_check ≥ 0 ∧ u_set < l_check
signature
external try(i:Index), crit(i:Index), exit(i:Index), rem(i:Index)
internal test(i:Index), set(i:Index),
check(i:Index), reset(i:Index)
states
x: Null[Index] := nil,
pc: Array[Index,PcValue] := constant(rem),
lastset: Array[Index, discrete AugmentedReal] := constant(infty),
firstcheck: Array[Index, discrete AugmentedReal] := constant(0),
now: Real:=0
FIGURE 4.5: Fischer’s mutual exclusion algorithm: Signature and states
since the receipt of the last message. A receive(m) transition can occur at any time; this causes
the variable
clock to be reset and the flag suspected to be set to false.Ifclock reaches
u before the arrival of a message, then the timeout action becomes enabled. The process sets
suspected to true as a result of a timeout.
The trajectory specification shows that
clock increases at the same rate as real time and
if
suspected = false, then time cannot go beyond the point where clock = u. Note that if
suspected = true, there is no restriction on the amount of time that can elapse.
Example 4.5 (Fischer’s algorithm). The timed automaton
FischerME presented in Figs. 4.5
and 4.6 is the specification of a shared memory mutual exclusion algorithm that uses a single
shared variable that can be read and written by all the participants. We fix here the number of
participants to be four, by defining
Index to be an enumeration consisting of four elements.
Note, however, that this specification can be generalized to any finite number of participants.
The automaton parameters
u set and l check represent upper and lower time bounds
for the
set(i) and check(i) actions, respectively. We assume that u set < l check.
The shared variable
x can be assigned any value of type Index plus one additional special
value
nil. If a process is in the critical region, then the variable x contains the index of that
process. If all users are in the remainder region, then the variable
x contains the value nil. The
array variable
pc records the program counters of all processes. The array variable lastset
keeps track of the deadlines by which the processes’ set actions must occur. Similarly, the array