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.

<strong>VDM</strong>-<strong>10</strong> <strong>Language</strong> <strong>Manual</strong><br />

start statement = ‘start’, ‘(’, expression, ‘)’ ;<br />

start list statement = ‘startlist’, ‘(’, expression, ‘)’ ;<br />

Semantics: The start and start list statements have the form:<br />

✞<br />

✡✝<br />

start(aRef)<br />

startlist(aRef_s)<br />

✆<br />

If a class description includes a thread (see section 16), each object created from this class<br />

will have the ability to operate as a stand-alone virtual machine, or in other terms: the object<br />

has its own processing capability. In this situation, a new expression creates the ‘process’<br />

leaving it in a waiting state. For such objects <strong>VDM</strong>++ and <strong>VDM</strong>-RT has a mechanism to<br />

change the waiting state into an active state 5 in terms of a predefined operation, which can<br />

be invoked through a start statement.<br />

The explicit separation of object creation and start provides the possibility to complete the<br />

initialisation of a (concurrent) system before the objects start exhibiting their described behaviour,<br />

in this way avoiding problems that may arise when objects are referred to that are<br />

not yet created and/or connected.<br />

A syntactic variant of the start statement is available to start up a number of active objects in<br />

arbitrary order: the start list statement. The parameter aRef s to startlist must be a<br />

set of object references to objects instantiated from classes containing a thread.<br />

Examples: Consider the specification of an operating system. A component of this would be the<br />

daemons and other processes started up during the boot sequence. From this perspective, the<br />

following definitions are relevant:<br />

✞<br />

types<br />

runLevel = nat;<br />

Process = Kerneld | Ftpd | Syslogd | Lpd | Httpd<br />

✡✝<br />

instance variables<br />

pInit : map runLevel to set of Process<br />

✆<br />

where Kerneld is an object reference type specified elsewhere, and similarly for the other<br />

processes listed.<br />

We can then model the boot sequence as an operation:<br />

5 When an object is in an active state, its behaviour can be described using a thread (see section 16).<br />

120

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

Saved successfully!

Ooh no, something went wrong!