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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

6.2 Concurrency and Synchronisation 155<br />

at the same time. However it also introduces more non-determinism. A problem is that<br />

processes can act on the same objects and can even execute the same method in the same<br />

object at the same time. The non-determinism is caused by the sharing <strong>of</strong> resources.<br />

To reduce non-determinism it is common to use semaphores for synchronisation and<br />

mutual exclusion.<br />

The sharing problem is an indication that processes as described above do not match very<br />

well with the concept <strong>of</strong> object. Objects should prevent sharing by strong encapsulation.<br />

The object’s message interface should be used as the only entrance to resources <strong>of</strong> the<br />

object.<br />

6.2.3.2 Restriction <strong>of</strong> Non-Determinism<br />

Non-determinism makes it very hard for designers to keep overview on the behaviour<br />

<strong>of</strong> a concurrent system. The problem is very well described by Selic et al. [SGW94]<br />

when they state that ’It is impossible to get an adequate mental model that keeps overview <strong>of</strong><br />

the relative progression <strong>of</strong> the threads. When we also take into account real-time aspects and<br />

the fact that in a distributed system the modules tend to have different execution speeds...’ In<br />

other words the huge number <strong>of</strong> possible orderings <strong>of</strong> actions and the huge possible<br />

state space is the biggest problem in the design <strong>of</strong> concurrent systems.<br />

We restrict synchronisation <strong>of</strong> concurrent threads to one mechanism: synchronous message<br />

passing via the message interface <strong>of</strong> process objects. The composite behaviour <strong>of</strong><br />

processes is completely determined by the synchronisation achieved by message passing.<br />

The already mentioned coincidence <strong>of</strong> the grain <strong>of</strong> abstraction (encapsulation) and<br />

the grain <strong>of</strong> concurrency, removes sharing and makes that synchronous message passing<br />

is enough to perform all necessary synchronisation and communication between<br />

process objects.<br />

The problem <strong>of</strong> modelling and understanding behaviour is now restricted to:<br />

the local (internal) sequential behaviour <strong>of</strong> processes;<br />

the composite behaviour <strong>of</strong> collaborating processes.<br />

So the interactions can be studied on two levels: inside and outside <strong>of</strong> processes. The<br />

inside behaviour must be able to handle all possible sequences <strong>of</strong> messages. The outside<br />

behaviour is determined by observation <strong>of</strong> messages on channels. All the interactions<br />

via the object’s message interface are analysed by playing scenarios <strong>of</strong> sending and<br />

receiving messages between collaborating objects. That is why our method pays a lot <strong>of</strong><br />

attention to the modelling <strong>of</strong> message flows. The various forms and their visualisation<br />

are described in Section 6.3.<br />

Where on the one side the amount <strong>of</strong> non-determinism is limited by making the message<br />

interface the place for all possible communication there are other aspects that determine<br />

non-determinism inside objects. First we <strong>of</strong>fer a non-deterministic choice statement.<br />

This statement requires to consider all possibilities <strong>of</strong> alternative behaviour. Secondly we

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

Saved successfully!

Ooh no, something went wrong!