Advanced Topics in SE Spring 2006 1 Process Algebra Hossein Hojjat Formal Methods Lab University of...

of 34/34
Advanced Topics in SE Spring 2006 1 Process Algebra Hossein Hojjat Formal Methods Lab University of Tehran
  • date post

    01-Jan-2016
  • Category

    Documents

  • view

    214
  • download

    0

Embed Size (px)

Transcript of Advanced Topics in SE Spring 2006 1 Process Algebra Hossein Hojjat Formal Methods Lab University of...

  • Process AlgebraHossein HojjatFormal Methods LabUniversity of Tehran

  • IntroductionThe lambda calculus models the functional computation completelyLambda calculus is unique: There is only one way to observe a functional computation watch which output values yields when presented with different input valuesBut the concurrent computation is not neat as functionalThere are many aspects to concurrent programming

  • Introduction (cont.)Concurrent systems can be described in terms of many different constructsFor creating processes fork/waitcobegin/coend, etc.Exchanging information between processesshared memoryrendezvousmessage-passingdata flow, etc.

  • Introduction (cont.)For managing the shared resourcessemaphoresmonitorstransactionsThis variability has rise to a large class of formal systems: Petri nets, event structures, actor model,In the process algebra approach every thing is considered to be a process

  • Introduction (cont.)We need not distinguish betweenactive components like senders and receiverspassive components such as communication mediaAll of the processes interact via synchronous message passingThis is the only basic mode of interaction

  • Process AlgebraProcessA behavior of a systemA system is anything showing behaviorSoftware system, actions of a machine, etc.AlgebraWe take an algebraic/axiomatic approach in talking about processesBy using axioms, we can perform calculations with processes

  • Process Algebra: Automata Theory ExtensionAn automata has a number of states and a number of transitionsThere are some initial and final statesA behavior is a run: a path from initial state to final stateTwo automata are equivalent when their languages are equal

  • Process Algebra: Automata Theory Extension (cont.)The automata model lacks the notion of interactionDuring the execution from initial to final state, a system may interact with other systemsThis is needed in modeling the reactive systems

  • Well Known Process AlgebrasIn the early eighties, Milner introduced CCS, Hoare introduced CSP and Bergstra introduced ACP calculus: In 1989, Milner extended CCS to take full advantage of named channelsPEPA (Performance Evaluation Process Algebra): a stochastic process algebraAmbient calculus: a process calculus used to describe and theorize about concurrent systems that include mobility

  • CCSThe Calculus of Communicating Systems (or CCS) is a process calculus developed by Robin Milner

    This lecture mainly focus on the CCS process algebra

  • The language CCSProcesses are called agents, built from a set of actionsActions can be:Observable, represented by letters a, b, etc.Unobservable (silent), marked by Observable actionsa, b, input actionsa, b, output actionsInput action a and output action a are complementary

  • The language CCS (cont.)If a means the reception of message a from the in port, the action a denotes the writing of the message to the out portThe following identity describes how the complementation of messages worksa = aThe most basic operator is 0 (read nill)Performs no action whatsoever

  • OperationsAgents may be constructed by employing process algebraic operations on other agentsThere are primarily five different methods of constructing agentsAction prefixingChoice operatorParallel compositionRestrictionRelabeling

  • Action PrefixingThe most basic process constructor in CCS is action prefixingIf a is an action and P is a process, then a.P is a processThe "." here is called "action prefixing" and denotes sequentializationP becomes active only after the action a has been performed

    a.PP

  • ExampleMatch = strike.0defCM = coin.coffee.CMdefClock = tick.Clockdef

  • Choice OperatorIf P and Q are processes, then so is P + QThe process P + Q has the initial capabilities of both P and QChoosing to perform initially an action from P will preempt the further executions of actions from Q, and vice versa

  • Example

    After having input a coin, the process CTM is willing to deliver either tea or coffeeIt depends upon the customers choiceteacoffee

  • Parallel CompositionLet Q and R be processes, (Q | R) is a processThe semantics of parallel composition:1. If M M, and N cannot perform , then M | N M | N2. If N N and M cannot perform , then M | N M | N3. If M M, and N N, then M | N M | N

  • ExampleCM = coin.coffee.CMdefCS = pub.coin.coffee.CSdefCS | CM

  • CommunicationThe computer scientist and coffee machine may communicate via the portsGiven two CCS expression P and Q, the process P | Q describes a system whichP and Q may proceed independentlyMay communicate via complementary ports

  • ExampleCMCScoincoffeecoffeecoinpubCM | CSCM|CS|CSCMCScoincoffeecoffeecoinpubCScoincoffeepub

  • RestrictionLet Q be a process and be a set of visible actions, . Then (Q) \ is a processIf Q Q and , , then ((Q) \ ) ((Q) \ )Process (Q) \ is like Q, but it cannot execute actions in the set or their complement actionsThe scope of port names in is restricted to Q

  • Example((CM|CS)\coin\coffee)|CSCMCSpubCScoincoffeepub

  • RelabelingLet Q be an agent and the set of its visible actions, Let be a set of actions and let m: U { } U { } such that m() = and : m()=m(). Then P ::= Q[m] is a processIf Q Q then Q[m] Q[m]Process P is like Q, but it actions have obtained by mapping the actions Q through m

  • ExampleVendingMachine = coin.item.VendingMachineCokeMachine = VendingMachine[coke/item]defCoffeeMachine = VendingMachine[coffee/item]def

  • Algebraic Operator Precedence1. Restriction and relabeling P\L P[f]2. Action prefixing .P3. Parallel composition P|Q4. Summation P+Q

    Q: How is R+a.P|b.Q\L then to be read ?A: R+((a.P)|(b.(Q\L))) !tightest

  • Semantics1. Operational SemanticsSpecifies the behavior of a programming language by defining a simple abstract machine for it2. Denotational SemanticsMap programs to denotationsDenotations are abstract representations details3. Axiomatic SemanticsInstead of first defining the behaviors of programs and then deriving laws from this definition, take the laws themselves as the definition of the language

  • SOSStructural Operational SemanticsDeveloped by Gordon Plotkin in 1981Represents computation by means of deductive systemsThese systems turn the abstract machine into a system of logical interferencesWith SOS semantics definitions are given by inference rules

  • InferenceInference rule consists of a conclusion that follows from a set of premises, possibly under control of some conditionspremise1premise2premisenconclusioncondition

  • SOS of CCSThe prefix is the only axiom in the system

    The parallel composition requires two symmetric rules:

    So as choice operator:QQP + QQ

  • SOS of CCS (cont.)Communication may happen when compatible prefixes are allowed

    Restriction and relabeling rulePPP | QP | QQQPPP \ LP \ L, LPPP [ f ]P [ f ]f()

  • Labeled transition systemSOS formally defines for each process term the labeled transition system that it stands forA labeled transition system (LTS) is a triple(S, Act, ) consisting ofa set S of statesa set Act of (action) labelsa transition relation S Act Sif (s,,s) we write s s

  • ExampleC0=is_0? . C0 + set_1 . C1 + set_0 . C0

    C1=is_1? . C1 + set_0 . C0 + set_1 . C1C0C1set_1set_0set_0is_0?set_1is_1?

  • Next sessionsimulationbisimulationbranching bisimulation