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.

292 Process Part <strong>of</strong> POOSL<br />

9.7.1 The Grain <strong>of</strong> Concurrency<br />

The grain <strong>of</strong> concurrency in POOSL is the processes object. All internal activities <strong>of</strong><br />

process objects are performed sequentially. The evaluation <strong>of</strong> data expressions, for<br />

example, is always performed from left to right. Consider message-send expression<br />

E m(E1 ¥¡ ¡ ¡ ¥ En). To evaluate this expression, first destination expression E is evaluated.<br />

Then the parameters E1 ¥¡ ¡ ¡ ¥ En are evaluated from left to right and finally the message<br />

is sent to the destination object. The order in which the expressions are evaluated is<br />

formalised by rules (a) and (b) <strong>of</strong> the transition system <strong>of</strong> Subsection 8.5.3:<br />

(a) Method call 1<br />

E e ¥ ¡ ¥ s¥<br />

(b) Method call 2<br />

¡<br />

¥ Sys £<br />

<br />

e e E ¥¡ ¡ ¡ ¥ m(E1 Ee ¥ s¥<br />

n)¥ ¡<br />

¡<br />

e e E ¥¡ ¡ ¡ ¥ m(E1 Ee ¡<br />

¡ ¥ s¡ ¥ ¡ n)¥<br />

<br />

<br />

E e ¥ ¡ ¥ s¥<br />

¡<br />

¥ Sys £<br />

E e ¡ ¥ ¡ ¡ ¥ s¡ ¥<br />

¡<br />

¥ Sys £<br />

¡ ¥ Sys<br />

E e ¡ ¥ ¡ ¡ ¥ s¡ ¥<br />

¡<br />

¡<br />

¡ ¥ Sys<br />

¥ Sys ¡<br />

¡<br />

m( ¤ 1 ¥¡ ¡ ¡ ¥ ¤ i 1 ¤ ¥ Ee ¡ ¡ ¥ E ¥¡ e )¥ ¡ ¥ s¥ n<br />

¤ m( ¤ 1 ¥¡ ¡ ¡ ¥ ¤ i 1 ¥ Ee ¡ ¥¡ ¡ ¡ ¥ E e n)¥ ¡ ¡ ¥ s¡ ¥<br />

¥ Sys £<br />

¡<br />

¡ ¥ Sys<br />

Why did we chose to evaluate the expressions in a strict sequential manner, instead <strong>of</strong><br />

in a concurrent one? For it seems that concurrent expression evaluation can easily be<br />

dealt with by replacing rule (b) by (b”):<br />

(b”) Method call 2<br />

<br />

e ¡ ¡<br />

<br />

¥ s¥<br />

e Ei ¡ ¥ ¡ ¡<br />

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

Ei ¥<br />

e<br />

<br />

e<br />

¥¡ ¡ ¡ ¥ E m(E1 Ee i 1 ¥ Eei ¥¡ ¡ ¡ ¥ Ee ¡<br />

s¥ ¥ ¡ n)¥<br />

¥ Sys £<br />

E e m(E e 1 ¥¡ ¡ ¡ ¥ E e i 1 ¥ Ee i ¡ ¥¡ ¡ ¡ ¥ Ee n )¥ ¡ ¡ ¥ s¡ ¥<br />

¥ Sys £<br />

¡<br />

¡ ¥ Sys<br />

However, if we take a closer look at this rule, we see that it does not formalise concurrent<br />

expression evaluation at all! The problem is that the rule allows n 1 different data<br />

objects to be executing one <strong>of</strong> their methods at the same time. Therefore n 1 different<br />

local variable environments have to be active at the same time. Unfortunately, there<br />

exists only one active environment and this environment is positioned at the top <strong>of</strong> stack<br />

s and belongs to the object which is currently executing one <strong>of</strong> its methods. This problem<br />

is not easily solved in our chosen type <strong>of</strong> semantics. Each possible solution will most<br />

certainly complicate the semantics in a serious way.<br />

Next to this theoretical difficulty <strong>of</strong> concurrent expression evaluation, a more practical<br />

problem exists. Consider the following definition <strong>of</strong> a (very simple and restricted) class<br />

Bit:

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

Saved successfully!

Ooh no, something went wrong!