concepts of concurrent computation
play

Concepts of Concurrent Computation computation? Turing machines or - PowerPoint PPT Presentation

Introduction Process Calculi Chair of Software Engineering Question : Why do we need a theoretical model of concurrent Concepts of Concurrent Computation computation? Turing machines or the -calculus have proved to be useful models of


  1. Introduction Process Calculi Chair of Software Engineering ◮ Question : Why do we need a theoretical model of concurrent Concepts of Concurrent Computation computation? ◮ Turing machines or the λ -calculus have proved to be useful models of Bertrand Meyer sequential systems Sebastian Nanz ◮ Abstracting away from implementation details yields general insights into programming and computation ◮ Process calculi help to focus on the essence of concurrent systems: Lecture 11: CCS interaction Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 2/44 Introduction Introduction The Calculus of Communicating Systems (CCS) Introductory Example: A Simple Process ◮ We study the Calculus of Communicating Systems (CCS) ◮ A coffee and tea machine may take an order for either tea or coffee, ◮ Introduced by [Milner 1980] accept the appropriate payment, pour the ordered drink, and ◮ Milner’s general model: terminate: ◮ A concurrent system is a collection of processes ◮ A process is an independent agent that may perform internal activities tea . coin . cup of tea . 0 + coffee . coin . coin . cup of coffee . 0 in isolation or may interact with the environment to perform shared activities ◮ We have the following elements of syntax: ◮ Milner’s insight: Concurrent processes have an algebraic structure ◮ Actions: tea , cup of tea , etc. ◮ Sequential composition: the dot “.” (first do action tea , then coin , ...) ◮ Non-deterministic choice: the plus “+” (either do tea or coffee ) P 1 op P 2 ⇒ P 1 op P 2 ◮ Terminated process: 0 ◮ This is why a process calculus is sometime called a process algebra Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 3/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 4/44

  2. Introduction Syntax of CCS Introductory Example: Execution of a Simple Process ◮ When a process executes it performs some action, and becomes a new process a ◮ The execution of an action a is symbolized by a transition − → Syntax of CCS tea . coin . cup of tea . 0 + coffee . coin . coin . cup of coffee . 0 tea − → coin . cup of tea . 0 coin − → cup of tea . 0 cup of tea − → 0 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 5/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 6/44 Syntax of CCS Syntax of CCS Syntax of CCS The Terminal Process ◮ Goal : In the following we introduce the syntax of CCS step-by-step The simplest possible behavior is no behavior Terminal process We write 0 (pronounced “nil”) for the terminal or inactive process Basic principle 1. Define atomic processes that model the simplest possible behavior ◮ 0 models a system that is either deadlocked or has terminated 2. Define composition operators that build more complex behavior from ◮ 0 is the only atomic process of CCS simpler ones Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 7/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 8/44

  3. Syntax of CCS Syntax of CCS Names and Actions Action Prefixing ◮ We assume an infinite set A of port names, and a set ¯ A = { ¯ a | a ∈ A} of complementary port names The simplest actual behavior is sequential behavior Action prefixing Input actions If P is a process we write When modeling we use a name a to denote an input action, i.e. the α. P receiving of input from the associated port a to denote the prefixing of P with the action α Output actions We use a co-name a to denote an output action, i.e. the sending of output to the associated port a ◮ α. P models a system that is ready to perform the action, α , and then behaves as P , i.e. Internal actions α α. P − → P We use τ to denote the distinguished internal action ◮ The set of actions Act is given by Act = A ∪ ¯ A ∪ { τ } Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 9/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 10/44 Syntax of CCS Syntax of CCS Example: Action Prefixing Process Interfaces Interfaces The set of input and output actions that a process P may perform in A process that starts a timer, performs some internal computation, and isolation constitutes the interface of P then stops the timer: ◮ The interface enumerates the ports that P may use to interact with go stop τ the environment go .τ. stop . 0 − → τ. stop . 0 − → stop . 0 − → 0 Example: The interface of the coffee and tea machine is: tea , coffee , coin , cup of tea , cup of coffee Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 11/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 12/44

  4. Syntax of CCS Syntax of CCS Non-deterministic Choice Example: Non-deterministic Choice A more advanced sequential behavior is that of alternative behaviors Non-deterministic choice tea . coin . cup of tea . 0 + coffee . coin . coin . cup of coffee . 0 If P and Q are processes then we write tea − → coin . cup of tea . P + Q Note that: to denote the non-deterministic choice between P and Q ◮ prefixing binds harder than plus and ◮ the choice is made by the initial coffee / tea button press ◮ P + Q models a process that can either behave as P (discarding Q ) or as Q (discarding P ) Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 13/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 14/44 Syntax of CCS Syntax of CCS Process Constants and Recursion Example: Recursion (1) The most advanced sequential behavior is the recursive behavior Process constants A system clock, SC , sends out regular clock signals forever: A process may be the invocation of a process constant, K ∈ K SC def = tick . SC This is only meaningful if K is defined beforehand Recursive definition The system SC may behave as: If K is a process constant and P is a process we write tick tick tick . SC − → SC − → . . . K def = P to give a recursive definition of the behavior of K (recursive if P invokes K ) Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 15/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 16/44

  5. Syntax of CCS Syntax of CCS Example: Recursion (2) Parallel Composition A fully automatic coffee and tea machine CTM works as follows: Finally: concurrent behavior CTM def Parallel composition = tea . coin . cup of tea . CTM + coffee . coin . coin . cup of coffee . CTM If P and Q are processes we write The system CTM may e.g. do: P | Q tea . coin . cup of tea . CTM + coffee . coin . coin . cup of coffee . CTM to denote the parallel composition of P and Q tea − → coin . cup of tea . CTM coin − → cup of tea . CTM ◮ P | Q models a process that behaves like P and Q in parallel: cup of tea − → CTM ◮ Each may proceed independently − α → . . . ◮ If P is ready to perform an action a and Q is ready to perform the complementary action a , they may interact This will serve drinks ad infinitum Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 17/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 18/44 Syntax of CCS Syntax of CCS Example: Parallel Composition Example: Parallel Composition Recall the coffee and tea machine: Recall the coffee and tea machine: CTM def CTM def = tea . coin . cup of tea . CTM + coffee . coin . coin . cup of coffee . CTM = tea . coin . cup of tea . CTM + coffee . coin . coin . cup of coffee . CTM Now consider the regular customer – the Computer Scientist, CS : Now consider the regular customer – the Computer Scientist, CS : CS def CS def = tea . coin . cup of tea . teach . CS = tea . coin . cup of tea . teach . CS + coffee . coin . coin . cup of coffee . publish . CS + coffee . coin . coin . cup of coffee . publish . CS ◮ CS must drink coffee to publish ◮ CS can only teach on tea Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 19/44 Bertrand Meyer Sebastian Nanz Concepts of Concurrent Computation 19/44

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend