VDM-10 Language Manual
VDM-10 Language Manual
VDM-10 Language Manual
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Chapter 15. Synchronization Constraints (<strong>VDM</strong>++ and <strong>VDM</strong>-RT)<br />
Inheritance of mutex constraints is completely analogous to the inheritance scheme for permission<br />
predicates. Internally mutex constraints are always expanded into appropriate permission<br />
predicates which are added to the existing permission predicates as a conjunction. This inheritance<br />
scheme ensures that the result (the final permission predicate) is the same, regardless of whether<br />
the mutex definitions are expanded in the base class and inherited as permission predicates or are<br />
inherited as mutex definitions and only expanded in the derived class.<br />
The intention for inheriting synchronization constraints in the way presented is to ensure, that<br />
any derived class at least satisfies the constraints of the base class. In addition to that it must be<br />
possible to strengthen the synchronization constraints. This can be necessary if the derived class<br />
adds new operations as in the following example:<br />
✞<br />
class A<br />
operations<br />
writer: () ==> ()<br />
writer() == is not yet specified<br />
reader: () ==> ()<br />
reader() == is not yet specified<br />
sync<br />
per reader => #active(writer) = 0;<br />
per writer => #active(reader, writer) = 0;<br />
end A<br />
class B is subclass of A<br />
operations<br />
newWriter: () ==> ()<br />
newWriter() == is not yet specified<br />
sync<br />
per reader => active(newWriter) = 0;<br />
per writer => #active(newWriter) = 0;<br />
per newWriter => #active(reader, writer, newWriter) = 0;<br />
end B<br />
✡✝<br />
✆<br />
Class A implements reader and writer operations with the permission predicates specifying the<br />
multiple readers-single writer protocol. The derived class B adds newWriter. In order to ensure<br />
deterministic behaviour B also has to add permission predicates for the inherited operations.<br />
The actual permission predicates in the derived class are therefore:<br />
143