Download Communicating Sequential Processes

Transcript
2.3
Concurrency
49
controlling or even of noticing them. Such events may occur independently
of Q whenever P engages in them. Similarly, Q may engage alone in events
which are in the alphabet of Q but not of P . Thus the set of all events that are
logically possible for the system is simply the union of the alphabets of the
component processes
α(P || Q ) = αP ∪ αQ
This is a rare example of an operator which takes operands with different alphabets, and yields a result with yet a third alphabet. However in the case when
the two operands have the same alphabet, so does the resulting combination,
and (P || Q ) has exactly the meaning described in the previous section.
Examples
X1 Let αNOISYVM = {coin, choc, clink, clunk, toffee}, where clink is the sound
of a coin dropping into the moneybox of a noisy vending machine, and clunk
is the sound made by the vending machine on completion of a transaction.
The noisy vending machine has run out of toffee
NOISYVM =
(coin → clink → choc → clunk → NOISYVM )
The customer of this machine definitely prefers toffee; the curse is what he
utters when he fails to get it; he then has to take a chocolate instead
αCUST =
{coin, choc, curse, toffee}
CUST =
(coin → (toffee → CUST | curse → choc → CUST ))
The result of the concurrent activity of these two processes is
(NOISYVM || CUST ) =
µ X • (coin → (clink → curse → choc → clunk → X
| curse → clink → choc → clunk → X ))
Note that the clink may occur before the curse, or the other way round. They
may even occur simultaneously, and it will not matter in which order they
are recorded. Note also that the mathematical formula in no way represents
the fact that the customer prefers to get a toffee rather than utter a curse. The
formula is an abstraction from reality, which ignores human emotions and concentrates on describing only the possibilities of occurrence and non-occurrence
of events within the alphabet of the processes, whether those events are desired or not.