VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
Chapter 15. Synchronization Constraints (<strong>VDM</strong>++ and <strong>VDM</strong>-RT)<br />
• a queue condition guard, which depends on the states of the queues formed by operation<br />
invocations (messages) awaiting service by the object.<br />
These guards can be freely mixed. Note that there is no syntactic distinction between these<br />
guards - they are all expressions. However they may be distinguished at the semantic level.<br />
A mutex predicate allows the user to specify either that all operations of the class are to be<br />
executed mutually exclusive, or that a list of operations are to be executed mutually exclusive<br />
to each other. Operations that appear in one mutex predicate are allowed to appear in other<br />
mutex predicates as well, and may also be used in the usual permission predicates. Each<br />
mutex predicate will implicitly be translated to permission predicates using history guards<br />
for each operation mentioned in the name list. For instance,<br />
✞<br />
sync<br />
mutex(opA, opB);<br />
mutex(opB, opC, opD);<br />
per opD => someVariable > 42;<br />
✡✝<br />
✆<br />
would be translated to the following permission predicates:<br />
✞<br />
sync<br />
per opA => #active(opB) = 0;<br />
per opB => #active(opA) = 0 and<br />
#active(opC) + #active(opD) = 0;<br />
per opC => #active(opB) + #active(opD) = 0;<br />
per opD => #active(opB) + #active(opC) = 0 and<br />
someVariable > 42;<br />
✡✝<br />
✆<br />
Note that it is only permitted to have one permission predicate for each operation. The<br />
#active operator is explained below.<br />
A mutex(all) constraint specifies that all of the operations specified in that class and any<br />
superclasses are to be executed mutually exclusively.<br />
15.1.1 History guards<br />
Semantics: A history guard is a guard which depends on the sequence of earlier invocations of the<br />
operations of the object expressed in terms of history expressions (see section 6.22). History<br />
expressions denotes the number of activations and completions of the operations, given as<br />
functions<br />
#act and #fin, respectively.<br />
139