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.

216 Modelling <strong>of</strong> Concurrent <strong>Reactive</strong> Behaviour<br />

corresponding to the reception <strong>of</strong> one <strong>of</strong> a collection <strong>of</strong> alternative messages or<br />

events that can happen. Another example <strong>of</strong> the need <strong>of</strong> non-determinism arises if<br />

a non- deterministic choice cannot be made because the details <strong>of</strong> events that cause a<br />

transition are not known yet. For instance, real-time properties <strong>of</strong> a subsystem may<br />

cause that a specific event happens always after another specific event. However,<br />

as long as we do not consider particular implementation decisions we cannot<br />

determine timing properties and consequently we cannot know such an order<br />

<strong>of</strong> events yet. Non-determinism <strong>of</strong>fers the possibility to describe the behaviour<br />

alternatives without the need to know the order.<br />

6. The rule § E S p denotes a so-called guarded command. The meaning is that the process<br />

statement S p will be taken into execution if the guard E evaluates to true. Execution<br />

waits if the guard evaluates to false. There could be confusion about the interpretation<br />

<strong>of</strong> the meaning <strong>of</strong> the evaluation <strong>of</strong> a guard when a guarded command is used<br />

as an alternative in an or statement. When the guarded command is selected the<br />

guard must be evaluated. The rest statement <strong>of</strong> the guarded command is executed<br />

if the result is true. However, when the guard is false than the rest statement cannot<br />

be executed. This means that the preceding select statement is taken into execution<br />

again and can make another choice. The fact that the guarded command is not<br />

executed means that the guard must be considered as not evaluated.<br />

7. The statement m(E1 ¥¡ ¡ ¡ ¥ En)(p1 ¥¡ ¡ ¡ ¥ pm) represents a method call. The execution<br />

<strong>of</strong> the method is prepared by evaluation <strong>of</strong> the expressions E1 ¥¡ ¡ ¡ ¥ En from left to<br />

right. Next the values are bound to the input parameters <strong>of</strong> the method m. All local<br />

variables and output parameters <strong>of</strong> the method are initialised to nil. Subsequently<br />

the method body is executed. If the body terminates successfully then results are<br />

stored in output parameters <strong>of</strong> the method that are bound to variables p1¥¡ ¡ ¡ ¥ pm.<br />

The behaviour <strong>of</strong> the process continues with the next statement after the method<br />

call.<br />

The method call can be used to construct infinite behaviour. The practical execution<br />

problem <strong>of</strong> stack overflow, that can be caused by recursive calls, is solved by<br />

<strong>of</strong>fering tail recursion. To construct infinite behaviour a method with no output<br />

parameters is called from another method with no output parameters, and vice<br />

versa. Such a call must be the final statement, the tail, <strong>of</strong> such methods. (See<br />

Subsection 9.7.4 for an example <strong>of</strong> tail recursion).<br />

8. The message-receive statement ch?m(p1 ¥¡ ¡ ¡ ¥ pm ¡ E) makes that a process object can<br />

receive messages from other process objects.<br />

9. The message-send statement ch!m(E1 ¥¡ ¡ ¡ ¥ En) makes that a process object can send<br />

messages to other process objects. Message modelling has been described extensively<br />

in Section 6.3.<br />

10. The abort statement S p<br />

1 abort S p<br />

2 enables the interruption <strong>of</strong> S p<br />

1 with alternative<br />

statement S p<br />

2. The abort happens if S p<br />

2 can be taken into execution and the execution<br />

arrived at a transition between two statements where interruption is allowed<br />

<strong>of</strong> S p<br />

1

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

Saved successfully!

Ooh no, something went wrong!