CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 1 Section 7 Modelling Concurrency using FSP.

Slides:



Advertisements
Similar presentations
Formal Methods for Software Engineering Lecture 5, Part II: FSP.
Advertisements

© 2012 Metamaxim Ltd Modelling Choreography Ashley McNeile 1 st February 2012.
Concurrency Important and difficult (Ada slides copied from Ed Schonberg)
Event structures Mauro Piccolo. Interleaving Models Trace Languages:  computation described through a non-deterministic choice between all sequential.
Concurrent Programming Problems OS Spring Concurrency pros and cons Concurrency is good for users –One of the reasons for multiprogramming Working.
3. Safety and Synchronization Prof. O. Nierstrasz Selected material © Magee and Kramer.
CSC321 §6 Modelling Processes using FSP 1 Section 6 Modelling Processes using FSP.
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
Interface Automata 29-September Modeling Temporal Behavior of Component Component behaves with Environment Traditional (pessimistic) approach –
1 Ivan Lanese Computer Science Department University of Bologna Italy Exploiting user-definable synchronizations in graph transformation.
Conformance Simulation Relation ( ) Let and be two automata over the same alphabet simulates () if there exists a simulation relation such that Note that.
1 Ivan Lanese Computer Science Department University of Bologna Roberto Bruni Computer Science Department University of Pisa A mobile calculus with parametric.
Concurrency: concurrent execution ©Magee/Kramer Claus Brabrand University of Aarhus Concurrent Execution Concurrency.
1 Formal Models for Distributed Negotiations Concurrent Languages Translation Roberto Bruni Dipartimento di Informatica Università di Pisa XVII Escuela.
1 IFM 2005 – November 30, 2005 EXP.OPEN 2.0 A flexible tool integrating partial order, compositional, and on-the-fly verification methods Frédéric Lang.
Chapter 11: Distributed Processing Parallel programming Principles of parallel programming languages Concurrent execution –Programming constructs –Guarded.
1 Ivan Lanese Computer Science Department University of Bologna Italy Concurrent and located synchronizations in π-calculus.
CP — Concurrent Programming 3. Safety and Synchronization Prof. O. Nierstrasz Wintersemester 2005 / 2006.
3. Safety and Synchronization Prof. O. Nierstrasz Selected material © Magee and Kramer.
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
Modelling for mere Mortals: Jeff Kramer
Fundamentals of Python: From First Programs Through Data Structures
Concurrency: shared objects & mutual exclusion1 ©Magee/Kramer 2 nd Edition Chapter 4 Shared Objects & Mutual Exclusion.
Pattern Abstract Factory
CSC321 §9 Deadlock 1 Section 9 Deadlock. CSC321 §9 Deadlock 2 Deadlock: four necessary and sufficient conditions  Serially reusable resources: the processes.
Concurrency Recitation – 2/24 Nisarg Raval Slides by Prof. Landon Cox.
Design Patterns Discussion of pages: xi-11 Sections: Preface, Forward, Chapter
(C) 2009 J. M. Garrido1 Object Oriented Simulation with Java.
An Introduction to Software Architecture
Concurrency: processes & threads1 ©Magee/Kramer Chapter 2 Processes & Threads.
Definitions & Scenarios. Acknowledgements  This tutorial is based in part on Concurrency: State Models & Java Programming by Jeff Magee and Jeff Kramer.
Concurrency: introduction1 ©Magee/Kramer 2 nd Edition COMP60611 Fundamentals of Parallel and Distributed Systems Lecture 5 Introduction to Concurrency:
SDS Foil no 1 Process Algebra Process Algebra – calculating with behaviours.
Advanced Topics in SE Spring Process Algebra Hossein Hojjat Formal Methods Lab University of Tehran.
Ivan Lanese Computer Science Department University of Bologna/INRIA Italy Amending Choreographies Joint work with Fabrizio Montesi and Gianluigi Zavattaro.
CSC321 §6 Modelling Processes using FSP 1 Chapter 6 Modelling Processes using FSP.
Concurrency: concurrent execution1 ©Magee/Kramer Chapter 3 Concurrent Execution.
95-843: Service Oriented Architecture 1 Master of Information System Management Service Oriented Architecture Lecture 7: BPEL Some notes selected from.
Parallel architecture Technique. Pipelining Processor Pipelining is a technique of decomposing a sequential process into sub-processes, with each sub-process.
Submodule construction in logics 1 Gregor v. Bochmann, University of Ottawa Using First-Order Logic to Reason about Submodule Construction Gregor v. Bochmann.
1 Qualitative Reasoning of Distributed Object Design Nima Kaveh & Wolfgang Emmerich Software Systems Engineering Dept. Computer Science University College.
CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 1 Chapter 7 Modelling Concurrency using FSP.
1 CSCI 6900: Design, Implementation, and Verification of Concurrent Software Eileen Kraemer September 7th, 2010 The University of Georgia.
Threaded Programming in Python Adapted from Fundamentals of Python: From First Programs Through Data Structures CPE 401 / 601 Computer Network Systems.
11/19/20151 Metodi formali nello sviluppo software a.a.2013/2014 Prof.Anna Labella.
Laws of concurrent design Tony Hoare Microsoft ResearchCambridge FMCAD October.
Formal Methods for Software Engineering Part II: Modelling & Analysis of System Behaviour.
2015 Concurrency: concurrent execution 1 ©Magee/Kramer 2 nd Edition Chapter 3 Concurrent Execution.
CS 5204 Spring 99 1 A Simple Agent A CCS agent is described both by a structural diagram and one or more algebraic equations. The diagram is for readability.
Assignment Help From Requirements Elicitation to Elicitation.
2G1516 Formal Methods2005 Mads Dam IMIT, KTH 1 CCS: Processes and Equivalences Mads Dam Reading: Peled 8.5.
Transparent First-class Futures and Distributed Components Introduction: components, futures, and challenges Statically Representing Futures An Example.
Concurrency 5 The theory of CCS Specifications and Verification Expressive Power Catuscia Palamidessi
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 10: Statecharts.
Chapter 8 Asynchronous System Model by Mikhail Nesterenko “Distributed Algorithms” by Nancy A. Lynch.
Reference – Object Oriented Software Development Using Java - Jia COP 3331 Object Oriented Analysis and Design Chapter 10 – Patterns Jean Muhammad.
1 Model-Checking of Component-Based Real-Time Embedded Software Based on CORBA Event Service Yuanfang Zhang for Seminar CSE7216 Presentation based on Zonghua.
A Formal Semantics for the Sky.NET Simulation Engine Timothy Bussmann Rice University.
Activity diagrams Practice 7. Task 1  The first action in the activity is the adding the item to the order. If the order if formed (“ready”), then it.
Concurrency: processes & threads1 ©Magee/Kramer 2 nd Edition Chapter 2 Processes & Threads.
1 Seminar on SOA Seminar on Service Oriented Architecture BPEL Some notes selected from “Business Process Execution Language for Web Services” by Matjaz.
1 Design Patterns prepared for COMP314, Bernhard Pfahringer see links on the web page as well!
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
Formal Methods for Software Engineering
Threaded Programming in Python
State Machine Model.
Background on the need for Synchronization
Process Algebra (2IF45) Extending Process Algebra: Abstraction
Encapsulation & Visibility Modifiers
Concurrency in Java Last Updated: Fall 2010 Paul Ammann SWE 619.
Presentation transcript:

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 1 Section 7 Modelling Concurrency using FSP

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 2 Parallel composition - action interleaving think  talk  scratch think  scratch  talk scratch  think  talk Possible traces as a result of action interleaving. If P and Q are processes then (P||Q) represents the concurrent execution of P and Q. The operator || is the parallel composition operator. ITCH = (scratch->STOP). CONVERSE = (think->talk->STOP). ||CONVERSE_ITCH = (ITCH || CONVERSE).

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 3 Parallel composition - action interleaving (0,0)(0,1)(0,2)(1,2) (1,1)(1,0) from CONVERSE from ITCH 2 states 3 states 2 x 3 states

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 4 Parallel composition - algebraic laws Commutative: (P||Q) = (Q||P) Associative: (P||(Q||R))= ((P||Q)||R) = (P||Q||R). Clock radio example: CLOCK = (tick->CLOCK). RADIO = (on->off->RADIO). ||CLOCK_RADIO = (CLOCK || RADIO). LTS? Traces? Number of states?

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 5 Modelling interaction - shared actions MAKER = (make->ready->MAKER). USER = (ready->use->USER). ||MAKER_USER = (MAKER || USER). MAKER synchronizes with USER when ready. If processes in a composition have actions in common, these actions are said to be shared. Shared actions are the way that process interaction is modelled. While unshared actions may be arbitrarily interleaved, a shared action must be executed at the same time by all processes that participate in the shared action. LTS? Traces? Number of states?

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 6 MAKERv2 = (make->ready->used->MAKERv2). USERv2 = (ready->use->used ->USERv2). ||MAKER_USERv2 = (MAKERv2 || USERv2). Modelling interaction - handshake A handshake is an action acknowledged by another: Interaction constrains the overall behaviour. 3 states 3 x 3 states? 4 states

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 7 Modelling interaction - multiple processes MAKE_A = (makeA->ready->used->MAKE_A). MAKE_B = (makeB->ready->used->MAKE_B). ASSEMBLE = (ready->assemble->used->ASSEMBLE). ||FACTORY = (MAKE_A || MAKE_B || ASSEMBLE). Multi-party synchronization:

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 8 Composite processes A composite process is a parallel composition of primitive processes. These composite processes can be used in the definition of further compositions. ||MAKERS = (MAKE_A || MAKE_B). ||FACTORY = (MAKERS || ASSEMBLE). Substituting the definition for MAKERS in FACTORY and applying the commutative and associative laws for parallel composition results in the original definition for FACTORY in terms of primitive processes. ||FACTORY = (MAKE_A || MAKE_B || ASSEMBLE).

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 9 Process labeling a:P prefixes each action label in the alphabet of P with a. SWITCH = (on->off->SWITCH). ||TWO_SWITCH = (a:SWITCH || b:SWITCH). Two instances of a switch process: ||SWITCHES(N=3) = (forall[i:1..N] s[i]:SWITCH). ||SWITCHES(N=3) = (s[i:1..N]:SWITCH). An array of instances of the switch process:

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 10 Process labelling by a set of prefix labels {a1,..,ax}::P replaces every action label n in the alphabet of P with the labels a1.n,…,ax.n. Further, every transition (n->X) in the definition of P is replaced with the transitions ({a1.n,…,ax.n} ->X). Process prefixing is useful for modelling shared resources: RESOURCE = (acquire->release->RESOURCE). USER = (acquire->use->release->USER). ||RESOURCE_SHARE = (a:USER || b:USER || {a,b}::RESOURCE).

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 11 Process prefix labels for shared resources How does the model ensure that the user that acquires the resource is the one to release it?

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 12 Action relabelling Relabelling to ensure that composed processes synchronize on particular actions. Relabelling functions are applied to processes to change the names of action labels. The general form of the relabelling function is: /{newlabel_1/oldlabel_1,… newlabel_n/oldlabel_n}. CLIENT = (call->wait->continue->CLIENT). SERVER = (request->service->reply->SERVER).

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 13 Action relabelling ||CLIENT_SERVER = (CLIENT || SERVER) /{call/request, reply/wait}.

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 14 Action relabelling - prefix labels SERVERv2 = (accept.request ->service->accept.reply->SERVERv2). CLIENTv2 = (call.request ->call.reply->continue->CLIENTv2). ||CLIENT_SERVERv2 = (CLIENTv2 || SERVERv2) /{call/accept}. An alternative formulation of the client server system is described below using qualified or prefixed labels:

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 15 Action hiding - abstraction to reduce complexity When applied to a process P, the hiding operator \{a1..ax} removes the action names a1..ax from the alphabet of P and makes these concealed actions "silent". These silent actions are labeled tau. Silent actions in different processes are not shared. When applied to a process P, the interface hides all actions in the alphabet of P not labeled in the set a1..ax. Sometimes it is more convenient to specify the set of labels to be exposed....

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 16 Action hiding USER = (acquire->use->release->USER) \{use}. USER = The following definitions are equivalent: Minimisation removes hidden tau actions to produce an LTS with equivalent observable behaviour.

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 17 Exercise A museum allows visitors to enter through the east entrance and leave through the west exit. Arrivals and departures are signaled to the museum controller by the turnstiles at the entrance and exit. At opening time, the museum director signals the controller that the museum is open and then the controller permits both arrivals and departures. At closing time, the director signals that the museum is closed, at which point only departures are permitted by the controller. Construct an FSP model of the museum using four processes: EAST, WEST, CONTROL and DIRECTOR.

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 18 /* museum */ const N = 5 EAST = (arrive -> EAST). WEST = (leave -> WEST). DIRECTOR = (open -> close -> DIRECTOR). CONTROL = CLOSED[0], CLOSED[i:0..N] = (when (i==0) open -> OPENED[0] |when (i>0) leave -> CLOSED[i-1]), OPENED[i:0..N] = (close -> CLOSED[i] |when (i OPENED[i+1] |when (i>0) leave -> OPENED[i-1]). ||MUSEUM = (EAST || WEST || DIRECTOR || CONTROL). Exercise

CSC321 Concurrent Programming: §7 Modelling Concurrency using FSP 19