-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathTokenRingThreeBit.prot
More file actions
77 lines (66 loc) · 1.95 KB
/
Copy pathTokenRingThreeBit.prot
File metadata and controls
77 lines (66 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Three bit token ring defined in
// Title: The Stabilizing Token Ring in Three Bits
// Author: Mohamed G. Gouda and F. Furman Haddix
// Year: 1996
constant N := 3;
direct variable t[N] < 2;
puppet variable e[N] < 2;
puppet variable ready[N] < 2;
// Make the invariant exactly this, no smoothing over puppet variables is allowed.
(future & shadow)
(
// One process has the token.
(unique i < N :
i == 0 && t[i-1] == t[i]
|| i != 0 && t[i-1] != t[i]
)
//&&
//// Some process is enabled.
//// This and the actual token-passing behavior are
//// already enforced by the shadow protocol.
//// already enforced by the shadow protocol.
//(exists i < N :
// i == 0 && e[i-1] == e[i]
// || i != 0 && e[i-1] != e[i]
//)
);
process Bot[i < 1]
{
read: e[i-1], t[i-1];
write: e[i], t[i], ready[i];
// Enforce this behavior within the invariant:
shadow action:( t[i-1] == t[i] --> t[i] := 1 - t[i-1]; );
// Use these actions:
puppet action:
( e[i-1] == e[i] && t[i-1] != t[i]
--> e[i] := 1-e[i-1]; ready[i] := 0;
);
puppet action:
( e[i-1] == e[i] && t[i-1] == t[i] && !(t[i] == 1 || ready[i] == 1)
--> e[i] := 1-e[i-1]; ready[i] := 1;
);
puppet action:
( e[i-1] == e[i] && t[i-1] == t[i] && (t[i] == 1 || ready[i] == 1)
--> e[i] := 1-e[i-1]; t[i] := 1-t[i-1]; ready[i] := 0;
);
}
process P[i <- map tid < N-1 : tid+1]
{
read: e[i-1], t[i-1];
write: e[i], t[i], ready[i];
// Enforce this behavior within the invariant:
shadow action:( t[i-1] != t[i] --> t[i] := t[i-1]; );
// Use these actions:
puppet action:
( e[i-1] != e[i] && t[i-1] == t[i]
--> e[i] := e[i-1]; ready[i] := 0;
);
puppet action:
( e[i-1] != e[i] && t[i-1] != t[i] && !(t[i] == 1 || ready[i] == 1)
--> e[i] := e[i-1]; ready[i] := 1;
);
puppet action:
( e[i-1] != e[i] && t[i-1] != t[i] && (t[i] == 1 || ready[i] == 1)
--> e[i] := e[i-1]; t[i] := t[i-1]; ready[i] := 0;
);
}