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

e’. Guarded command<br />

<br />

§ Sp C p <br />

¡£ Er¢ ¥ ¡ ¡<br />

¡ ¥ ps¡ ¥ ¡ ¥ Sys E1£ ¡ ¡ p <br />

<br />

Sys ¥<br />

§ S p£ e C p E1£ ¡ ¡ ¡£ Er¢ ¥<br />

<br />

§ E S § p C p ¡ ¡ ¡£ Er¢ ¥<br />

<br />

E1£<br />

¡ ¡ ¥ ps¡ ¡ ¥ ¡<br />

<br />

¡<br />

<br />

ps¥<br />

<br />

¥<br />

¡<br />

¡<br />

£<br />

¡ ¥ Sys ¡ p Sys ¥<br />

Sys ¥ p £ ¥ Sys<br />

¡<br />

¡ ¥ ps¡ ¡ ¥ ¡ ¡ ¥ Sys ¡ ¡ p Sys ¥<br />

S § p£ e<br />

Cp ¡£ Er¢ ¥ E1£ ¡ ¡<br />

¡ ¡ <br />

¥ ps¡ ¥ ¡ ¥ Sys ¡<br />

if<br />

( ¥ ¡ £<br />

¡<br />

ps¥ ¥ Sys ) with ¡ true¥ bunk¦<br />

E¥ ¡ ¥<br />

In the alternative approach, the guarded command could have been described by the<br />

following axiom and rule:<br />

Guarded command, axiom<br />

<br />

<br />

§ § S p C p E1£ ¡ ¡ ¡ £ Er¢ ¥<br />

§ S p C p E1£ ¡ ¡ ¡ £ Er¢ ¥<br />

¡<br />

s¥ ¥ Sys ¥ ¡ p <br />

Sys ¥<br />

¥ s¥ ¥ ¡ Sysp Sys ¥<br />

if true or bunk<br />

Guarded command, rule<br />

<br />

<br />

§ E e C p E1£ ¡ ¡ ¡ £ Er¢ ¥<br />

§ E e ¡ C p E1£ ¡ ¡ ¡£ Er¢ ¥<br />

¡<br />

¡<br />

s¥ ¥ Sys ¥ ¡ p <br />

Sys ¥<br />

¡<br />

£<br />

¥ Sys ¡ p Sys ¥<br />

¡ s¡ ¡ ¥ ¥<br />

<br />

§ § Ee S p C p <br />

¡£ Er¢ ¥ ¡ ¡<br />

¥ s¥ ¥ Sys E1£ ¡ ¡ p <br />

<br />

£ Sys¡ ¥<br />

§ § E e ¡ S p C p E1£ ¡ ¡ ¡ £ Er¢ ¥<br />

¡<br />

¡ ¥ s¡ ¥ ¡ ¥ Sys ¡ p Sys ¥<br />

The problem is that this alternative formulation changes the intended meaning <strong>of</strong><br />

guarded commands in combination with choice statements. Consider a process object<br />

C() that is executing § true statement ch?m § true ch¡ ?m¡ or . If the rules <strong>of</strong> the layered semantics<br />

are applied, the process always leaves both alternatives open. It never chooses a<br />

priori whether it wants to receive message m from channel ch or m¡ message from channel<br />

. The actual choice depends on environment processes that are able to communicate<br />

ch¡<br />

with C(). In case <strong>of</strong> the alternative semantics the choice is made a priori by process C()<br />

itself. If environment processes are only willing to send message m on channel ch, a<br />

deadlock may occur if C() chooses to m¡ receive ch¡ from . This can never happen in case<br />

<strong>of</strong> the layered semantics.<br />

The problem is caused by the fact that guarded commands and choice statements are<br />

orthogonal language constructs. A possible (partial) solution is to replace guarded<br />

commands and choice statements by so-called select statements. An example <strong>of</strong> such a<br />

select statement is<br />

sel<br />

§ E1 ch!m(E2 ¥ E3) then S p<br />

1<br />

or<br />

§ E4 ch¡ ?m¡ (p1) then S p<br />

2<br />

or<br />

§ E5 ch¡ ¡ !m¡ ¡ (E6) then S p<br />

3<br />

les<br />

¤ £<br />

a<br />

a

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

Saved successfully!

Ooh no, something went wrong!