Book Chapter 3 - PowerPoint PPT Presentation

1 / 19
About This Presentation
Title:

Book Chapter 3

Description:

CSC321 Concurrent Programming: 7 Modelling Concurrency using FSP. 1. Section 7 ... from ITCH. 2 states. 3 states. 2 x 3 states ... – PowerPoint PPT presentation

Number of Views:47
Avg rating:3.0/5.0
Slides: 20
Provided by: jeffk59
Category:
Tags: book | chapter | itch

less

Transcript and Presenter's Notes

Title: Book Chapter 3


1
Section 7
Modelling Concurrency using FSP
2
Parallel composition - action interleaving
ITCH (scratch-gtSTOP). CONVERSE
(think-gttalk-gtSTOP). CONVERSE_ITCH (ITCH
CONVERSE).
think?talk?scratch think?scratch?talk scratch?thin
k?talk
Possible traces as a result of action
interleaving.
3
Parallel composition - action interleaving
2 states
3 states
(0,0)
(0,1)
(0,2)
(1,2)
(1,1)
(1,0)
from ITCH
2 x 3 states
from CONVERSE
4
Parallel composition - algebraic laws
Clock radio example
CLOCK (tick-gtCLOCK). RADIO (on-gtoff-gtRADIO).
CLOCK_RADIO (CLOCK RADIO).
LTS? Traces? Number of states?
5
Modelling interaction - shared actions
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.
MAKER (make-gtready-gtMAKER). USER
(ready-gtuse-gtUSER). MAKER_USER (MAKER
USER).
MAKER synchronizes with USER when ready.
LTS? Traces? Number of states?
6
Modelling interaction - handshake
A handshake is an action acknowledged by another
MAKERv2 (make-gtready-gtused-gtMAKERv2). USERv2
(ready-gtuse-gtused -gtUSERv2). MAKER_USERv2
(MAKERv2 USERv2).
3 states
3 states
3 x 3 states?
4 states
Interaction constrains the overall behaviour.
7
Modelling interaction - multiple processes
Multi-party synchronization
MAKE_A (makeA-gtready-gtused-gtMAKE_A). MAKE_B
(makeB-gtready-gtused-gtMAKE_B). ASSEMBLE
(ready-gtassemble-gtused-gtASSEMBLE). FACTORY
(MAKE_A MAKE_B ASSEMBLE).
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).
9
Process labeling
aP prefixes each action label in the alphabet of
P with a.
Two instances of a switch process
SWITCH (on-gtoff-gtSWITCH). TWO_SWITCH
(aSWITCH bSWITCH).
10
Process labelling by a set of prefix labels
a1,..,axP replaces every action label n in
the alphabet of P with the labels a1.n,,ax.n.
Further, every transition (n-gtX) in the
definition of P is replaced with the transitions
(a1.n,,ax.n -gtX).
Process prefixing is useful for modelling shared
resources
RESOURCE (acquire-gtrelease-gtRESOURCE). USER
(acquire-gtuse-gtrelease-gtUSER).
RESOURCE_SHARE (aUSER bUSER
a,bRESOURCE).
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?
12
Action relabelling
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.
Relabelling to ensure that composed processes
synchronize on particular actions.
CLIENT (call-gtwait-gtcontinue-gtCLIENT). SERVER
(request-gtservice-gtreply-gtSERVER).
13
Action relabelling
CLIENT_SERVER (CLIENT SERVER)
/call/request, reply/wait.
14
Action relabelling - prefix labels
An alternative formulation of the client server
system is described below using qualified or
prefixed labels
SERVERv2 (accept.request
-gtservice-gtaccept.reply-gtSERVERv2). CLIENTv2
(call.request -gtcall.reply-gtcontinue-gt
CLIENTv2). CLIENT_SERVERv2 (CLIENTv2
SERVERv2) /call/accept.
15
Action hiding - abstraction to reduce complexity
Sometimes it is more convenient to specify the
set of labels to be exposed....
When applied to a process P, the interface
operator _at_a1..ax hides all actions in the
alphabet of P not labeled in the set a1..ax.
16
Action hiding
The following definitions are equivalent
USER (acquire-gtuse-gtrelease-gtUSER)
\use. USER (acquire-gtuse-gtrelease-gtUSER)
_at_acquire,release.
Minimisation removes hidden tau actions to
produce an LTS with equivalent observable
behaviour.
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.
18
Exercise
/ museum / const N 5 EAST (arrive -gt
EAST). WEST (leave -gt WEST). DIRECTOR (open
-gt close -gt DIRECTOR). CONTROL
CLOSED0, CLOSEDi0..N (when (i0) open -gt
OPENED0
when (igt0) leave -gt CLOSEDi-1), OPENEDi0..N
(close -gt CLOSEDi when
(iltN) arrive -gt OPENEDi1
when (igt0) leave -gt OPENEDi-1). MUSEUM
(EAST WEST DIRECTOR CONTROL).
19
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com