23.08.2013 Views

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

Specification of Reactive Hardware/Software Systems - Electronic ...

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.

9.7 The Development <strong>of</strong> POOSL 293<br />

data class Bit<br />

instance variables bit<br />

instance methods<br />

error setToZero setToOne invert<br />

primitive bit 0; bit 1; if bit 0 then bit : bit 1<br />

self self else bit : bit ¤ 1 fi;<br />

if bit 0 or bit ¡ 1 then self error fi;<br />

self<br />

Primitive message error aborts the execution with an error message. Assume that a<br />

variable b refers to a Bit which is setToZero and consider the concurrent evaluation <strong>of</strong><br />

expression (b invert) ¡ (b invert). It seems clear that the result <strong>of</strong> this evaluation must<br />

be true 8 . Indeed, true is one <strong>of</strong> the possible outcomes. Another possibility, however, is<br />

that the evaluation aborts with an error message, leaving b in the unexpected state where<br />

instance variable bit refers to 2!<br />

Problems <strong>of</strong> this kind are well-known in object-oriented languages, such as Smalltalk-80<br />

[GR89], that support processes as an orthogonal language concept. These processes may<br />

act on the same collection <strong>of</strong> objects. It is even possible that they are executing the same<br />

method in the same object at the same time [AR89b]. This can result in problems <strong>of</strong><br />

synchronisation and mutual exclusion as in the case <strong>of</strong> our Bit example.<br />

Of course, these problems <strong>of</strong> synchronisation and mutual exclusion can be solved if<br />

concurrently evaluated expressions are required to be side-effect free. However, the<br />

application <strong>of</strong> expressions with side-effects in object-oriented languages is not at all<br />

unusual. In Eiffel [Mey88], a restricted use <strong>of</strong> functions with side-effects is even recommended<br />

and exploited (see also Paragraph 6.6.3.5).<br />

The problems described above also occur when other forms <strong>of</strong> concurrency within<br />

process objects are allowed. We have therefore determined the grain <strong>of</strong> concurrency at<br />

the level <strong>of</strong> the process object.<br />

9.7.2 Conditional Message Reception<br />

The basic process communication model in POOSL is based upon the synchronous pairwise<br />

message-passing mechanism <strong>of</strong> CCS [Mil89]. In this model, processes communicate<br />

by exchanging messages over (static) channels. If a process sends a message on a<br />

channel, it has in principle no knowledge <strong>of</strong> the identity <strong>of</strong> the receiving process. Vice<br />

versa, if a process receives a message, it has no knowledge <strong>of</strong> the senders identity. The<br />

basic communication model <strong>of</strong> POOSL thus allows the modelling <strong>of</strong> strongly distributed<br />

systems (see also Paragraph 6.4.4.2). However, many complex (object-oriented) systems<br />

are characterised by weak distribution (see Paragraph 6.4.4.1). A process in a weakly<br />

8 Note that the primitive equality message only determines whether two expressions refer to the<br />

same object or not.

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

Saved successfully!

Ooh no, something went wrong!