the calculus of communicating systems dr liam o connor
play

The Calculus of Communicating Systems Dr. Liam OConnor University - PowerPoint PPT Presentation

CCS The Calculus of Communicating Systems Dr. Liam OConnor University of Edinburgh LFCS (and UNSW) Term 2 2020 1 CCS Where we are at Last lecture we concluded our examination of proof methods for concurrency by examining compositional


  1. CCS The Calculus of Communicating Systems Dr. Liam O’Connor University of Edinburgh LFCS (and UNSW) Term 2 2020 1

  2. CCS Where we are at Last lecture we concluded our examination of proof methods for concurrency by examining compositional techniques. We also discussed how to prove properties of asynchronous systems. This lecture, we’ll take a brief detour into the world of process algebra , a high level formalism for describing concurrent systems. In particular we will examine CCS, but similar principles apply for other formalisms like CSP and ACP. Many of the resources for this lecture were borrowed from Graham Hutton. 2

  3. CCS CCS The Calculus of Communicating Systems : Is a process algebra , a simple formal language to describe concurrent systems. 3

  4. CCS CCS The Calculus of Communicating Systems : Is a process algebra , a simple formal language to describe concurrent systems. Is given semantics in terms of labelled transition systems . 4

  5. CCS CCS The Calculus of Communicating Systems : Is a process algebra , a simple formal language to describe concurrent systems. Is given semantics in terms of labelled transition systems . Was developed by Turing-award winner Robin Milner in the 1980s. Has an abstract view of synchronization that applies well to message passing. 5

  6. CCS CCS The Calculus of Communicating Systems : Is a process algebra , a simple formal language to describe concurrent systems. Is given semantics in terms of labelled transition systems . Was developed by Turing-award winner Robin Milner in the 1980s. Has an abstract view of synchronization that applies well to message passing. Why do we learn this? This gives us a symbolic way to describe our transition diagrams, and reason about them symbolically rather than diagramatically. 6

  7. CCS Processes Processes in CCS are defined by equations: Example The equation: CLOCK = tick defines a process CLOCK that simply executes the action “tick” and then terminates. This process corresponds to the first location in this labelled transition system (LTS): • tick • An LTS is like a transition diagram, save that our transitions are just abstract actions and we have no initial or final location. 7

  8. CCS Action Prefixing Example CLOCK 2 = tick . tock defines a process called CLOCK 2 that executes the action “tick” then the action “tock” and then terminates. tick tock • • • The process: CLOCK 3 = tock . tick has the same actions as CLOCK 2 but arranges them in another order.

  9. CCS Action Prefixing Example Definition CLOCK 2 = tick . tock If a is an action and P is a process, then x . P is a process that executes x defines a process called CLOCK 2 that before P . This brackets to the right, so: executes the action “tick” then the action “tock” and then terminates. x . y . z . P = x . ( y . ( z . P )) tick tock • • • The process: CLOCK 3 = tock . tick has the same actions as CLOCK 2 but arranges them in another order.

  10. CCS Action Prefixing Example Definition CLOCK 2 = tick . tock If a is an action and P is a process, then x . P is a process that executes x defines a process called CLOCK 2 that before P . This brackets to the right, so: executes the action “tick” then the action “tock” and then terminates. x . y . z . P = x . ( y . ( z . P )) tick tock • • • Stopping More precisely, we should write: The process: CLOCK 3 = tock . tick CLOCK 2 = tick . tock . STOP has the same actions as CLOCK 2 but where STOP is the trivial process with arranges them in another order. no transitions. 10

  11. CCS Loops Up to now, all processes make a finite number of transitions and then terminate. Processes that can make a infinite number of transitions can be pictured by allowing loops: Example (Loops) • tick tick the process that diverges = the process that alternates tock tick = executing “tick” transitions “tick” and “tock” forever • • We accomplish loops in CCS using recursion.

  12. CCS Loops Up to now, all processes make a finite number of transitions and then terminate. Processes that can make a infinite number of transitions can be pictured by allowing loops: Example (Loops) • tick tick the process that diverges = the process that alternates tock tick = executing “tick” transitions “tick” and “tock” forever • • CLOCK 4 = tick . CLOCK 4 CLOCK 5 = tick . tock . CLOCK 5 We accomplish loops in CCS using recursion. 12

  13. CCS Equality of Processes These two processes are physically different: • tick tick tick tick • • CLOCK 4 = tick . CLOCK 4 CLOCK 6 = tick . tick . CLOCK 6 13

  14. CCS Equality of Processes These two processes are physically different: • tick tick tick tick • • CLOCK 4 = tick . CLOCK 4 CLOCK 6 = tick . tick . CLOCK 6 But they both have the same behaviour — an infinite sequence of “tick” transitions. 14

  15. CCS Equality of Processes These two processes are physically different: • tick tick tick tick • • CLOCK 4 = tick . CLOCK 4 CLOCK 6 = tick . tick . CLOCK 6 But they both have the same behaviour — an infinite sequence of “tick” transitions. Informal Definition We consider two process to be equal if an external observer cannot distinguish them by their actions. We will refine this definition later. 15

  16. CCS A Simple Vending Machine Vending Machines are very common examples for process algebra. Example (An inflexible machine) Suppose I define my vending machine as: in50 ¢ • • VM 1 = in50 ¢ . outCoke . in20 ¢ . outMars . VM 1 outMars outCoke • • in20 ¢ 16

  17. CCS A Simple Vending Machine Vending Machines are very common examples for process algebra. Example (An inflexible machine) Suppose I define my vending machine as: in50 ¢ • • VM 1 = in50 ¢ . outCoke . in20 ¢ . outMars . VM 1 outMars outCoke • • in20 ¢ This machine is not very flexible: It only accepts exact money. The customer has no choice: The machine dispenses Coke and Mars bars alternately. 17

  18. CCS Choice To make a more flexible kind of vending machine, we need a (nondeterministic) choice operator. 18

  19. CCS Choice To make a more flexible kind of vending machine, we need a (nondeterministic) choice operator. Example outMars outCoke • in20 ¢ in50 ¢ VM 2 = (in50 ¢ . outCoke . VM 2 ) + (in20 ¢ . outMars . VM 2 ) • • Here we have a process VM 2 that repeatedly either inputs 50 ¢ and outputs a coke, or inputs 20 ¢ and outputs a mars bar. 19

  20. CCS Choice To make a more flexible kind of vending machine, we need a (nondeterministic) choice operator. Example outMars outCoke • in20 ¢ in50 ¢ VM 2 = (in50 ¢ . outCoke . VM 2 ) + (in20 ¢ . outMars . VM 2 ) • • Here we have a process VM 2 that repeatedly either inputs 50 ¢ and outputs a coke, or inputs 20 ¢ and outputs a mars bar. Definition If P and Q are processes then P + Q is a process which can either behave as the process P or the process Q . 20

  21. CCS Choice Equalities Observe that we have the following identities about choice: P + ( Q + R ) = ( P + Q ) + R (associativity) 21

  22. CCS Choice Equalities Observe that we have the following identities about choice: P + ( Q + R ) = ( P + Q ) + R (associativity) P + Q = Q + P (commutativity) 22

  23. CCS Choice Equalities Observe that we have the following identities about choice: P + ( Q + R ) = ( P + Q ) + R (associativity) P + Q = Q + P (commutativity) P + STOP = (neutral element) P 23

  24. CCS Choice Equalities Observe that we have the following identities about choice: P + ( Q + R ) = ( P + Q ) + R (associativity) P + Q = Q + P (commutativity) P + STOP = (neutral element) P P + P = P (idempotence) 24

  25. CCS Choice Equalities Observe that we have the following identities about choice: P + ( Q + R ) = ( P + Q ) + R (associativity) P + Q = Q + P (commutativity) P + STOP = (neutral element) P P + P = P (idempotence) What about the equation: ? a . ( P + Q ) ( a . P ) + ( a . Q ) = • • a a a ? • • • = Q Q P P 25

  26. CCS Branching Time Example VM 3 = in50 ¢ . (outCoke + outPepsi) VM 4 = (in50 ¢ . outCoke) + (in50 ¢ . outPepsi) • • in50 ¢ in50 ¢ in50 ¢ • • • outPepsi outCoke outPepsi outCoke • • • • Or in pictures: 26

  27. CCS Branching Time Example VM 3 = in50 ¢ . (outCoke + outPepsi) VM 4 = (in50 ¢ . outCoke) + (in50 ¢ . outPepsi) • • in50 ¢ in50 ¢ in50 ¢ • • • outPepsi outCoke outPepsi outCoke • • • • Or in pictures: Reactive Systems VM 3 allows the customer to choose which drink to vend after inserting 50 ¢ . In VM 4 however, the machine makes the choice when the customer inserts a coin. 27

  28. CCS Branching Time Example VM 3 = in50 ¢ . (outCoke + outPepsi) VM 4 = (in50 ¢ . outCoke) + (in50 ¢ . outPepsi) • • in50 ¢ in50 ¢ in50 ¢ • • • outPepsi outCoke outPepsi outCoke • • • • Or in pictures: Reactive Systems VM 3 allows the customer to choose which drink to vend after inserting 50 ¢ . In VM 4 however, the machine makes the choice when the customer inserts a coin. They different in this reactive view, but they have the same behaviours! 28

  29. CCS Equivalences The equation a . ( P + Q ) = ( a . P ) + ( a . Q ) is usually not admitted for this reason. 29

Recommend


More recommend