Download presentation
Presentation is loading. Please wait.
Published byMaude Harvey Modified over 9 years ago
1
1 1.10 Model 3: Message-Passing Text We saw –Diagrams –Shared-variables text Now –Message-passing text (like CSP)
2
2 In the communication statements, – we name a channel, – and not the communication partner directly. This naming convention –Leads to better encapsulation of processes, –Allows many-to-many communication through a single channel.
3
3 Modifications to shared-variables text language: –Disallow the use of shared variables, omit synchronization statements based on them –Add new communication statements based on msg passing.
4
4 Communication statements Channel dcl. Send Receive p. 71
5
5 Buffering capability Unbounded buffering (async) Bounded buffering (async) No buffering (sync) The usual convention in buffering: keeping the order of sending messages.
6
6 For buffered communication, we add a new variable to the set of state variables Π. The domain of this variable consists of lists of elements of the declared type. Transition relations in p. 72, 73
7
7 No buffering –Two parallel statements are considered to be matching if they form a send and receive pair on the same channel. –When two matching statements are jointly ready to execute, their execution is atomic and simultaneous and the effect is equivalent to an assignment statement. –P. 74
8
8 No buffering is not the same as buffering with N=0 Buffering with N=0 does not allow any send statement to be executed. (not the case in Promela) See Fig. 1.15, p. 76 Problem 1.6
9
9 Three examples for producer-consumer –With bounded buffering Fig. 1.16, p.77 –With unbounded buffering But the channel should never hold more than N pending message Fig. 1.17, p.78 –Conditional communication statement An additional statement
10
10 Conditional communication statement Conditional send and receive P. 79 –Async communication –Sync communication –Example: Prod-cons without buffering –Fig. 1.19, p. 81 Problem 1.7
11
11 Comparison of sync and async models We could implement an async problem, using sync constructs –By introducing a process as a channel Sync communication is a more primitive concept than async (is it?) We need some “ack” channel, like in Fig. 1.17 ( extended Rebeca)
12
12 A Fair Server There is a single process, server S, that is expected to provide services to N customer processes, called P[1], …, P[N]. The server can serve only one customer at a time. A fair server using shared variables, Fig. 1.20 p.84 A fair server using message passing, Fig. 1.21 p.85 –It is different from 1.20
13
13 1.11 Model 4: Petri Nets ∈ ΣΠΛΦμθ≠
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.