-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJobber.xml
More file actions
188 lines (186 loc) · 5.39 KB
/
Jobber.xml
File metadata and controls
188 lines (186 loc) · 5.39 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE nta PUBLIC '-//Uppaal Team//DTD Flat System 1.1//EN' 'http://www.it.uu.se/research/group/darts/uppaal/flat-1_2.dtd'>
<nta>
<declaration>// Place global declarations here.
chan get_mallet, get_hammer, put_mallet, put_hammer;
const int MaxJobs = 10;
int [0,MaxJobs] jobs;</declaration>
<template>
<name x="5" y="5">Jobber</name>
<declaration>// Place local declarations here.</declaration>
<location id="id0" x="-178" y="-8">
<name x="-229" y="-17">Begin</name>
</location>
<location id="id1" x="-51" y="-8">
<name x="-61" y="-42">Average</name>
</location>
<location id="id2" x="-51" y="-110">
<name x="-61" y="-144">Easy</name>
</location>
<location id="id3" x="-51" y="94">
<name x="-61" y="60">Hard</name>
</location>
<location id="id4" x="85" y="-110">
<name x="75" y="-144">Easy_Work</name>
</location>
<location id="id5" x="76" y="-34">
<name x="66" y="-68">Average_Work_With_Mallet</name>
</location>
<location id="id6" x="76" y="25">
<name x="68" y="34">Average_Work_With_Hammer</name>
</location>
<location id="id7" x="76" y="93">
<name x="59" y="102">Hard_Work_With_Hammer</name>
</location>
<location id="id8" x="-178" y="93">
<name x="-229" y="85">Done</name>
</location>
<branchpoint id="id9" x="-178" y="-8">
</branchpoint>
<branchpoint id="id10" x="-178" y="-8">
</branchpoint>
<init ref="id0"/>
<transition>
<source ref="id4"/>
<target ref="id0"/>
<nail x="289" y="-110"/>
<nail x="289" y="-212"/>
<nail x="-178" y="-212"/>
</transition>
<transition>
<source ref="id7"/>
<target ref="id0"/>
<label kind="synchronisation" x="144" y="68">put_hammer!</label>
<nail x="280" y="93"/>
<nail x="289" y="93"/>
<nail x="289" y="-212"/>
<nail x="-178" y="-212"/>
</transition>
<transition>
<source ref="id6"/>
<target ref="id0"/>
<label kind="synchronisation" x="144" y="0">put_hammer!</label>
<nail x="289" y="25"/>
<nail x="289" y="-212"/>
<nail x="-178" y="-212"/>
</transition>
<transition>
<source ref="id5"/>
<target ref="id0"/>
<label kind="synchronisation" x="144" y="-34">put_mallet!</label>
<nail x="289" y="-34"/>
<nail x="289" y="-212"/>
<nail x="-178" y="-212"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id8"/>
</transition>
<transition>
<source ref="id3"/>
<target ref="id7"/>
<label kind="synchronisation" x="-34" y="93">get_hammer!</label>
</transition>
<transition>
<source ref="id1"/>
<target ref="id6"/>
<label kind="synchronisation" x="-42" y="17">get_hammer!</label>
</transition>
<transition>
<source ref="id1"/>
<target ref="id5"/>
<label kind="synchronisation" x="-17" y="-59">get_mallet!</label>
</transition>
<transition>
<source ref="id2"/>
<target ref="id4"/>
</transition>
<transition>
<source ref="id0"/>
<target ref="id2"/>
<label kind="guard" x="-160" y="-93">jobs < MaxJob</label>
<label kind="assignment" x="-161" y="-76">jobs++</label>
</transition>
<transition>
<source ref="id0"/>
<target ref="id3"/>
<label kind="assignment" x="-136" y="59">jobs++</label>
</transition>
<transition>
<source ref="id0"/>
<target ref="id1"/>
<label kind="assignment" x="-127" y="-8">jobs++</label>
</transition>
</template>
<template>
<name>Hammer</name>
<location id="id11" x="0" y="0">
<name x="-51" y="-17">Free</name>
</location>
<location id="id12" x="153" y="0">
<name x="170" y="-17">Taken</name>
</location>
<init ref="id11"/>
<transition>
<source ref="id12"/>
<target ref="id11"/>
<label kind="synchronisation" x="34" y="68">put_hammer?</label>
<nail x="153" y="68"/>
<nail x="0" y="68"/>
</transition>
<transition>
<source ref="id11"/>
<target ref="id12"/>
<label kind="synchronisation" x="34" y="-25">get_hammer?</label>
</transition>
</template>
<template>
<name>Mallet</name>
<location id="id13" x="0" y="0">
<name x="-10" y="-34">Free</name>
</location>
<location id="id14" x="144" y="0">
<name x="134" y="-34">Taken</name>
</location>
<init ref="id13"/>
<transition>
<source ref="id14"/>
<target ref="id13"/>
<label kind="synchronisation" x="34" y="51">put_mallet?</label>
<nail x="144" y="51"/>
<nail x="0" y="51"/>
</transition>
<transition>
<source ref="id13"/>
<target ref="id14"/>
<label kind="synchronisation" x="34" y="-25">get_mallet?</label>
</transition>
</template>
<system>// Place template instantiations here.
Jobber1 = Jobber();
Jobber2 = Jobber();
// List one or more processes to be composed into a system.
system Jobber1, Jobber2, Hammer, Mallet;
</system>
<queries>
<query>
<formula>A[] Hammer.Taken == (Jobber1.Hard_Work_With_Hammer || Jobber2.Hard_Work_With_Hammer ||
Jobber1.Average_Work_With_Hammer || Jobber2.Average_Work_With_Hammer)</formula>
<comment></comment>
</query>
<query>
<formula>A[] Mallet.Taken == (Jobber1.Average_Work_With_Mallet ||
Jobber2.Average_Work_With_Mallet)</formula>
<comment>mallet can only be used by jobber1 and jobber2</comment>
</query>
<query>
<formula>E<> (Jobber1.Hard && Jobber2.Hard)</formula>
<comment>can jobber1 and jobber2 be in Hard state</comment>
</query>
<query>
<formula>A[] not deadlock || (Jobber1.Done && Jobber2.Done)
</formula>
<comment>This tests deadlocks</comment>
</query>
</queries>
</nta>