25.07.2014 Views

VDM-10 Language Manual

VDM-10 Language Manual

VDM-10 Language Manual

SHOW MORE
SHOW LESS

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<br />

Synchronization Constraints (<strong>VDM</strong>++ and<br />

<strong>VDM</strong>-RT)<br />

In general a complete system contains objects of a passive nature (which only react when their<br />

operations are invoked) and active objects which ‘breath life’ into the system. These active objects<br />

behave like virtual machines with their own processing thread of control and after start up they do<br />

not need interaction with other objects to continue their activities. In another terminology a system<br />

could be described as consisting of a number of active clients requesting services of passive or<br />

active servers. In such a parallel environment the server objects need synchronization control to be<br />

able to guarantee internal consistency, to be able to maintain their state invariants. Therefore, in a<br />

parallel world, a passive object needs to behave like a Hoare monitor with its operations as entries.<br />

If a sequential system is specified (in which only one thread of control is active at a time) only a<br />

special case of the general properties is used and no extra syntax is needed. However, in the course<br />

of development from specification to implementation more differences are likely to appear.<br />

The following default synchronization rules for each object apply in <strong>VDM</strong>++ and <strong>VDM</strong>-RT:<br />

• operations are to be viewed as though they are atomic, from the point of the caller;<br />

• operations which have no corresponding permission predicate are subject to no restrictions<br />

at all;<br />

• synchronization constraints apply equally to calls within an object (i.e. one operation within<br />

an object calls another operation within that object) and outside an object (i.e. an operation<br />

from one object calls an operation in another object);<br />

• operation invocations have the semantics of a rendez-vous (as in Ada, see [Ada LRM]) in<br />

case two active objects are involved. Thus if an object O 1 calls an operation o in object<br />

O 2 , if O 2 is currently unable to start operation o then O 1 blocks until the operation may<br />

be executed. Thus invocation occurs when both the calling object and the called object are<br />

ready. (Note here a slight difference from the semantics of Ada: in Ada both parties to the<br />

rendez-vous are active objects; in <strong>VDM</strong>++ and <strong>VDM</strong>-RT only the calling party is active)<br />

137

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!