Computation Orchestration Jayadev Misra Department of Computer - - PowerPoint PPT Presentation

computation orchestration
SMART_READER_LITE
LIVE PREVIEW

Computation Orchestration Jayadev Misra Department of Computer - - PowerPoint PPT Presentation

D EPARTMENT OF C OMPUTER S CIENCES Computation Orchestration Jayadev Misra Department of Computer Science University of Texas at Austin Email: misra@cs.utexas.edu web: http://www.cs.utexas.edu/users/psp Collaborators: William Cook, Tony Hoare,


slide-1
SLIDE 1

DEPARTMENT OF COMPUTER SCIENCES

Computation Orchestration

Jayadev Misra Department of Computer Science University of Texas at Austin Email: misra@cs.utexas.edu web: http://www.cs.utexas.edu/users/psp

Collaborators: William Cook, Tony Hoare, Galen Menzel

UNIVERSITY OF TEXAS AT AUSTIN

slide-2
SLIDE 2

DEPARTMENT OF COMPUTER SCIENCES

Example: Airline

Contact two airlines simultaneously for price quotes. Buy ticket from either airline if its quote is at most $300. Buy the cheapest ticket if both quotes are above $300. Buy any ticket if the other airline does not provide a timely quote. Notify client if neither airline provides a timely quote.

UNIVERSITY OF TEXAS AT AUSTIN 1

slide-3
SLIDE 3

DEPARTMENT OF COMPUTER SCIENCES

Example: workflow

An office assistant contacts a potential visitor. The visitor responds, sends the date of her visit. The assistant books an airline ticket and

contacts two hotels for reservation.

After hearing from the airline and any of the hotels:

he tells the visitor about the airline and the hotel.

The visitor sends a confirmation which the assistant notes.

UNIVERSITY OF TEXAS AT AUSTIN 2

slide-4
SLIDE 4

DEPARTMENT OF COMPUTER SCIENCES

Example: workflow, contd.

After receiving the confirmation, the assistant

confirms hotel and airline reservations. reserves a room for the lecture. announces the lecture by posting it at a web-site. requests a technician to check the equipment in the room.

UNIVERSITY OF TEXAS AT AUSTIN 3

slide-5
SLIDE 5

DEPARTMENT OF COMPUTER SCIENCES

Wide-area Computing

Acquire data from remote services. Calculate with these data. Invoke yet other remote services with the results. Additionally Invoke alternate services for failure tolerance. Repeatedly poll a service. Ask a service to notify the user when it acquires the appropriate data. Download an application and invoke it locally. Have a service call another service on behalf of the user.

UNIVERSITY OF TEXAS AT AUSTIN 4

slide-6
SLIDE 6

DEPARTMENT OF COMPUTER SCIENCES

The Nature of Distributed Applications

Three major components in distributed applications: Persistent storage management databases by the airline and the hotels. Specification of sequential computational logic does ticket price exceed $300? Methods for orchestrating the computations contact the visitor for a second time only after hearing from the airline and one of the hotels. We look at only the third problem.

UNIVERSITY OF TEXAS AT AUSTIN 5

slide-7
SLIDE 7

DEPARTMENT OF COMPUTER SCIENCES

Related Models and Languages

Process Calculi: CSP

, CCS,

  • calculus, Join Calculus
Petri Net Statechart Programming Languages

– Pict: Based on

  • calculus

– C

!: Based on Join Calculus

– Concurrent ML, Concurrent Haskell: Based on CCS (see List Monads) – Esterel, Lustre

UNIVERSITY OF TEXAS AT AUSTIN 6

slide-8
SLIDE 8

DEPARTMENT OF COMPUTER SCIENCES

Related Work, Applications

Workflow: Based on

extensions to petri nets,

  • calculus
Busieness Process Orchestration: BPEL, OWL-S, ...

UNIVERSITY OF TEXAS AT AUSTIN 7

slide-9
SLIDE 9

DEPARTMENT OF COMPUTER SCIENCES

Site

Compose basic computing elements called Sites. A site is a

function: Compress MPEG file method of an object: LogOn procedure at a bank monitor procedure: read from a buffer web service: CNN, get a stock quote transaction: check account balance distributed transaction: move money from one bank to another Humans: Send email, expect report

UNIVERSITY OF TEXAS AT AUSTIN 8

slide-10
SLIDE 10

DEPARTMENT OF COMPUTER SCIENCES

More on Sites

Site calls are strict: Arguments must be defined. A site returns at most one value. A site may not respond.

Its response at different times (for the same input) may be different.

A site call may change states (of external servers) tentatively or

permanently. Tentative state changes are made permanent by explicit commitment.

A site may be an argument of a site call.

UNIVERSITY OF TEXAS AT AUSTIN 9

slide-11
SLIDE 11

DEPARTMENT OF COMPUTER SCIENCES

Some Fundamental Sites

0 : never responds. l et(x; y ;
  • ): returns a tuple of its argument values.
if (b): boolean b,

returns a signal if

b is true; remains silent if b is false. S ig nal returns a signal immediately. Same as if (true ). R timer (t): integer t, t
  • 0, returns a signal
t time units later.

UNIVERSITY OF TEXAS AT AUSTIN 10

slide-12
SLIDE 12

DEPARTMENT OF COMPUTER SCIENCES

Orc

An Orc expression is

  • 1. Simple: just a site call, or
  • 2. composition of two Orc expressions

Evaluation of Orc expression: calls some sites, publishes some values

UNIVERSITY OF TEXAS AT AUSTIN 11

slide-13
SLIDE 13

DEPARTMENT OF COMPUTER SCIENCES

Simple Orc Expression

CNN (d)

calls site

CNN ,

publishes the value, if any, returned by the site.

UNIVERSITY OF TEXAS AT AUSTIN 12

slide-14
SLIDE 14

DEPARTMENT OF COMPUTER SCIENCES

Composition Operators

do

f and g in parallel f j g

Symmetric composition for all

x from f do g f > x > g

Sequencing for some

x from f do g g where x:2 f

Asymmetric composition

UNIVERSITY OF TEXAS AT AUSTIN 13

slide-15
SLIDE 15

DEPARTMENT OF COMPUTER SCIENCES

Composition Operators, Examples

  • CNN
j B B C

Symmetric composition

  • CNN
> x > E mail (addr ess; x)

Sequencing

  • (E
mail (addr ess; x) where x:2 (CNN j B B C ))

Asymmetric composition

UNIVERSITY OF TEXAS AT AUSTIN 14

slide-16
SLIDE 16

DEPARTMENT OF COMPUTER SCIENCES

Conventions

Precedence of binding:

where ,

j ,
  • No arithmetic or logic capability in Orc.

Can’t write

u + v or x _ y.

Write

add(u; v ) and
  • r
(x; y ), where add and
  • r are sites.
Convention: In examples, I write u + v and x _ y.

Assume that a compiler converts these to

add(u; v ) and
  • r
(x; y ).

UNIVERSITY OF TEXAS AT AUSTIN 15

slide-17
SLIDE 17

DEPARTMENT OF COMPUTER SCIENCES

Centralized Execution Model

An expression is evaluated on a single machine (client). Client communicates with sites by messages.
  • R
timer is local to client. All fundamental sites are local to the client.

All except

R timer respond immediately. We show concurrent and distributed executions later.

UNIVERSITY OF TEXAS AT AUSTIN 16

slide-18
SLIDE 18

DEPARTMENT OF COMPUTER SCIENCES

Symmetric composition:

f j g

Evaluate

f and g independently.

Publish all values from both. Example:

CNN j B B C : calls both CNN and B B C simultaneously.

Publishes values returned by both sites. (

0, 1 or 2 values)

Note: No direct communication or interaction between

f and g.

They may communicate only through sites.

UNIVERSITY OF TEXAS AT AUSTIN 17

slide-19
SLIDE 19

DEPARTMENT OF COMPUTER SCIENCES

Sequencing:

f >x > g

For all values published by

f do
  • g. Publish only the values from
g.
  • CNN
> x > E mail (addr ess; x)

Call

CNN . Name any value returned
  • x. Call
E mail (addr ess; x).

Publish the value (a signal), if any, returned by

E mail.
  • (C
N N j B B C ) > x > E mail (addr ess; x)

May call

E mail twice. Publishes up to two signals.

Notation: Write

f
  • g for
f > x > g if x unused in g.

UNIVERSITY OF TEXAS AT AUSTIN 18

slide-20
SLIDE 20

DEPARTMENT OF COMPUTER SCIENCES

Notes on Sequencing

  • is associative.
> x > is right associative. A fresh evaluation of g is started with each returned value
  • x. Many

copies of

g may be executing, possibly, with f . If f publishes at most one value, f > x > g is f ;g. If f publishes no value, g is never evaluated in f > x > g.

UNIVERSITY OF TEXAS AT AUSTIN 19

slide-21
SLIDE 21

DEPARTMENT OF COMPUTER SCIENCES

Questions

M j M ? = M (M j N )
  • R
? = M
  • R
j N
  • R
M
  • (N
j R ) ? = M
  • N
j M
  • R
if (b)
  • M
j if (:b)
  • M
? = M

UNIVERSITY OF TEXAS AT AUSTIN 20

slide-22
SLIDE 22

DEPARTMENT OF COMPUTER SCIENCES

(M j N )
  • R =
M
  • R
j N
  • R

Evaluate

M and N . For each published value, call R.

N R R M

Thus,

R may be called twice. (E mail (addr ess1; messag e) j E mail (addr ess2; messag e))
  • Notify

Double notification.

UNIVERSITY OF TEXAS AT AUSTIN 21

slide-23
SLIDE 23

DEPARTMENT OF COMPUTER SCIENCES

M
  • (N
j R ) 6= M
  • N
j M
  • R

M >> (N | R) M >> N | M>> R M M M N R N R

UNIVERSITY OF TEXAS AT AUSTIN 22

slide-24
SLIDE 24

DEPARTMENT OF COMPUTER SCIENCES

Asymmetric parallel composition:

(g where x:2 f )

For some value published by

f do
  • g. Publish only the values from
g. Evaluate f and g in parallel. When f returns a value, assign it to x and terminate f . Any site call in g which does not name x can proceed. (M j N (x)) where x:2 f A site calls which names x waits until x gets a value. Values published by g are the values of (g where x:2 f ).

UNIVERSITY OF TEXAS AT AUSTIN 23

slide-25
SLIDE 25

DEPARTMENT OF COMPUTER SCIENCES

Pruning the computation

(CNN j B B C ) > x > E mail (addr ess; x)

May send two emails. To send just one email:

E mail (addr ess; x) where x:2 (CNN j B B C )

UNIVERSITY OF TEXAS AT AUSTIN 24

slide-26
SLIDE 26

DEPARTMENT OF COMPUTER SCIENCES

Notify after both respond

(E mail (addr ess1; messag e) j E mail (addr ess2; messag e))
  • Notify

Use

((l et(u; v )
  • Notify

where

u:2 E mail (addr ess1; messag e))

where

v :2 E mail (addr ess2; messag e))

Adopt the notation:

(l et(u; v )
  • Notify

where

u:2 E mail (addr ess1; messag e) v :2 E mail (addr ess2; messag e))

UNIVERSITY OF TEXAS AT AUSTIN 25

slide-27
SLIDE 27

DEPARTMENT OF COMPUTER SCIENCES

Eager Evaluation in

(g where x:2 f ) In M j N (x) where x:2 f : g is evaluated, i.e., M is called even before x has a value.

Any response from

M will be published even before x has a value. In M
  • N
(x) where x:2 f : f is evaluated even before the value of x is needed.

UNIVERSITY OF TEXAS AT AUSTIN 26

slide-28
SLIDE 28

DEPARTMENT OF COMPUTER SCIENCES

Difference in evaluation strategies

In f > x > g, g is not evaluated if f is silent. In (g where x:2 f ), g may be partially evaluated if f is silent. Analogous to difference in values of quantified expressions over

empty range.

UNIVERSITY OF TEXAS AT AUSTIN 27

slide-29
SLIDE 29

DEPARTMENT OF COMPUTER SCIENCES

Fundamental Site

0 is a site which never responds.

Example: send an email but do not wait for its response:

(E mail (addr ess1; messag e)
  • j
Notify )

UNIVERSITY OF TEXAS AT AUSTIN 28

slide-30
SLIDE 30

DEPARTMENT OF COMPUTER SCIENCES

Expression Definition

An expression is defined like a procedure.

MailOn e (a)
  • E
mail (a; m) where m:2 (CNN j BBC ) Ti ker (a; t)
  • MailOn
e (a)
  • R
timer (t)
  • Ti ker
(a; t)

Note:

Ti ker does not publish a value.

UNIVERSITY OF TEXAS AT AUSTIN 29

slide-31
SLIDE 31

DEPARTMENT OF COMPUTER SCIENCES

Metronome

Publish a signal at every time unit.

Metr
  • nome
  • S
ig nal j R timer (1)
  • Metr
  • nome

S R S R

Publish

n signals. BM (0)
  • BM
(n)
  • S
ig nal j R timer (1)
  • BM
(n
  • 1)

UNIVERSITY OF TEXAS AT AUSTIN 30

slide-32
SLIDE 32

DEPARTMENT OF COMPUTER SCIENCES

Example of Expression call

Site Quer y returns a value (different ones at different times). Site A ept(x) returns x if x is acceptable. Produce all acceptable values by calling Quer y at unit intervals

forever.

R ep e atQuery
  • Metr
  • nome
  • Quer
y > x > A ept(x)

UNIVERSITY OF TEXAS AT AUSTIN 31

slide-33
SLIDE 33

DEPARTMENT OF COMPUTER SCIENCES

Asynchronous Semantics

Call sites eventually. In

M j N , the sites may be called at arbitrary times.

In

M j R timer (1), R timer is any site that returns a signal after unit time.

UNIVERSITY OF TEXAS AT AUSTIN 32

slide-34
SLIDE 34

DEPARTMENT OF COMPUTER SCIENCES

Synchronous Semantics

Call sites as soon as possible. Consequently:

In M j N , both sites are called simultaneously. A response is processed only if no site can be called. In (g where x:2 f ), x gets the first value from f .

Fundamental sites get priority: Process responses from fundamental sites before any other response.

UNIVERSITY OF TEXAS AT AUSTIN 33

slide-35
SLIDE 35

DEPARTMENT OF COMPUTER SCIENCES

Some Fundamental Sites

0 : never responds. l et(x; y ;
  • ): returns a tuple of its argument values.
if (b): boolean b,

returns a signal if

b is true; remains silent if b is false. S ig nal returns a signal immediately. Same as if (true ). R timer (t): integer t, t
  • 0, returns a signal
t time units later.

UNIVERSITY OF TEXAS AT AUSTIN 34

slide-36
SLIDE 36

DEPARTMENT OF COMPUTER SCIENCES

Small Examples

Call site M four times, at unit time intervals. M j R timer (1)
  • M
j R timer (2)
  • M
j R timer (3)
  • M
Time-out: return M ’s response if it arrives before t, return 0 after t. l et(z ) where z :2 M j R timer (t)
  • l
et(0)

UNIVERSITY OF TEXAS AT AUSTIN 35

slide-37
SLIDE 37

DEPARTMENT OF COMPUTER SCIENCES

Priority

Receive N ’s response asap, but no earlier than 1 unit from now. D el ay (N )
  • R
timer (1)
  • l
et(u) where u:2 N Call M , N together.

If

M responds within one unit, take its response.

Else, pick the first response.

l et(x) where x:2 M j D el ay (N )

UNIVERSITY OF TEXAS AT AUSTIN 36

slide-38
SLIDE 38

DEPARTMENT OF COMPUTER SCIENCES

Recursive definition with time-out

Call a list of sites. Count the number of responses received within 10 time units.

tal l y ([ ℄)
  • l
et(0) tal l y (M : M S )
  • u
+ v

where

u:2 M
  • l
et(1) j R timer (10)
  • l
et(0) v :2 tal l y (M S )

UNIVERSITY OF TEXAS AT AUSTIN 37

slide-39
SLIDE 39

DEPARTMENT OF COMPUTER SCIENCES

Opera Seat assignments

An opera house has a list of patrons. It emails each patron a set of seats, from which the patron can

choose.

It contacts the patrons one at a time, and uses time-out if some patron

does not respond.

  • Assig
n(x; m): x is a patron, m a seat. Assigns m to x.
  • O
per a(ps; s): ps is a list of patrons (in decreasing order of priority), s a set of available seats,

performs assignments.

UNIVERSITY OF TEXAS AT AUSTIN 38

slide-40
SLIDE 40

DEPARTMENT OF COMPUTER SCIENCES

Opera Seat assignments, contd.

O per a([℄; fg)
  • fAll patrons and seats assigned g
O per a(ps; fg)
  • fall seats assigned to patronsg
O per a([℄; s)
  • fAll patrons assigned seatsg
O per a(x : ps; s)
  • O
per a(ps; t)

where

t:2 x(s) > m > Assig n(x; m)
  • l
et(s
  • fmg)
j R timer (1)
  • l
et(s)

UNIVERSITY OF TEXAS AT AUSTIN 39

slide-41
SLIDE 41

DEPARTMENT OF COMPUTER SCIENCES

Sequential Computing

  • (S
; T ) is (S
  • T
)
  • if
b then S

else

T

is

if (b )
  • S
j if (:b )
  • T
  • while
B (x) do x:= S (x) l
  • op(x)
  • B
(x) > b > (if (b )
  • S
(x) > y > l
  • op(y
) j if (:b )
  • l
et(x))

UNIVERSITY OF TEXAS AT AUSTIN 40

slide-42
SLIDE 42

DEPARTMENT OF COMPUTER SCIENCES

Kleene Star

For a given x, produce the set of values x; M (x); M (x) > y > M (y ); M (x) > y > M (y ) > z > M (z ); : : : Mstar (x)
  • l
et(x) j M (x) > y > Mstar (y ) Produce the same set of values without x, i.e., M (x); M (x) > y > M (y ); M (x) > y > M (y ) > z > M (z ); : : : Mplus (x)
  • M
(x) > y > (l et(y ) j Mplus (y ))

UNIVERSITY OF TEXAS AT AUSTIN 41

slide-43
SLIDE 43

DEPARTMENT OF COMPUTER SCIENCES

Arbitration

In CCS:

  • :P
+
  • :Q

In Orc:

if (b )
  • P
j if (:b )
  • Q

where

b :2 Al pha
  • l
et(true ) j B eta
  • l
et(false )

UNIVERSITY OF TEXAS AT AUSTIN 42

slide-44
SLIDE 44

DEPARTMENT OF COMPUTER SCIENCES

Time-out

Return

(x; true ) if M returns x before t, and (; false ) otherwise. l et(z ; b)

where

(z ; b):2 M > x > l et(x; true ) j R timer (t) > x > l et(x; false )

UNIVERSITY OF TEXAS AT AUSTIN 43

slide-45
SLIDE 45

DEPARTMENT OF COMPUTER SCIENCES

Fork-join parallelism

Call

M and N in parallel.

Return their values as a tuple after both respond.

l et(u; v )

where

u:2 M v :2 N

Return a signal after both respond.

l et(u)
  • l
et(v )

where

u:2 M v :2 N

UNIVERSITY OF TEXAS AT AUSTIN 44

slide-46
SLIDE 46

DEPARTMENT OF COMPUTER SCIENCES

Screen Refresh

Get: screen image, keyboard input, mouse position every time unit. Call

D r aw with this triple. Metr
  • nome
( l et(i; k ; m)

where

i :2 Image k :2 Keyb
  • ar
d m :2 Mouse

)

> x > D r aw (x)

UNIVERSITY OF TEXAS AT AUSTIN 45

slide-47
SLIDE 47

DEPARTMENT OF COMPUTER SCIENCES

Barrier Synchronization

Synchronize

M
  • f and
N
  • g:
f and g start only after both M and N complete.

Rendezvous of CSP or CCS;

M and N are complementary actions.

(

l et(u; v )

where

u:2 M v :2 N )
  • (f
j g )

To pass values from

M and N to f and g, modify last line: > (u; v ) > (f j g )

UNIVERSITY OF TEXAS AT AUSTIN 46

slide-48
SLIDE 48

DEPARTMENT OF COMPUTER SCIENCES

Interrupt handling

Orc statement can not be directly interrupted.
  • Interrupt site: a monitor.
  • Interrupt
:set: to interrupt the Orc statement
  • Interrupt
:g et: responds after Interrupt :set has been called.

Use

l et(z ) where z :2 f j Interrupt :g et

UNIVERSITY OF TEXAS AT AUSTIN 47

slide-49
SLIDE 49

DEPARTMENT OF COMPUTER SCIENCES

Interrupt; contd.

Determine if there has been an interrupt:

al l M
  • (l
et(z ; b)

where

(z ; b):2 M > x > l et(x; true ) j I nter r upt:g et > x > l et(x; false ) )

Process Interrupt:

al l M > (z ; b) > ( if (b ) “Normal processing with value z” j if (:b ) “Interrupt Processing” )

UNIVERSITY OF TEXAS AT AUSTIN 48

slide-50
SLIDE 50

DEPARTMENT OF COMPUTER SCIENCES

Parallel or

Sites

M and N return booleans. Compute their parallel or.

Below

ift (b) = if (b)
  • l
et(true ). ift (b) returns true if b is true; silent otherwise. ift (x) j ift (y ) j
  • r
(x; y )

where

x:2 M ; y :2 N

Return just one value.

l et(z )

where

z :2 ift (x) j ift (y ) j
  • r
(x; y ) x:2 M ; y :2 N

UNIVERSITY OF TEXAS AT AUSTIN 49

slide-51
SLIDE 51

DEPARTMENT OF COMPUTER SCIENCES

Airline quotes: Application of Parallel or

Contact airlines

A and B.

Return any quote if it is below

as soon as it is available,
  • therwise return the minimum quote.
thr eshold (x) returns x if x < ; silent otherwise. Min (x; y ) returns the minimum of x and y. l et(z )

where

z :2 thr eshold (x) j thr eshold (y ) j Min (x; y ) x:2 A y :2 B

UNIVERSITY OF TEXAS AT AUSTIN 50

slide-52
SLIDE 52

DEPARTMENT OF COMPUTER SCIENCES

Backtracking: Eight queens

... ...

Row 1 Row 2 Row 3 x

...

x x 1 x 1 1 7 7 7 7 x

... ...

x x 1 1 7

Figure 1: Backtrack Search for Eight queens

UNIVERSITY OF TEXAS AT AUSTIN 51

slide-53
SLIDE 53

DEPARTMENT OF COMPUTER SCIENCES

Eight queens; contd.

configuration: placement of queens in the last i rows. Represent a configuration by a list of integers j ,
  • j
  • 7.
Valid configuration: no queen captures another.

UNIVERSITY OF TEXAS AT AUSTIN 52

slide-54
SLIDE 54

DEPARTMENT OF COMPUTER SCIENCES

Eight queens; contd.

Site he k (x: xs): Given xs is valid,

return

x:xs, if it is valid; remain silent otherwise Produce all valid extensions of z by placing n additional queens: z is a valid configuration, 1
  • n and
jz j + n
  • 8
Define extend(z ; n) extend(z ; 1)
  • he k
(0: z ) j he k (1: z ) j
  • j
he k (7: z ) extend(z ; n)
  • extend(z
; 1) > y > extend(y ; n
  • 1)
Solve the original problem by calling extend([ ℄; 8).

UNIVERSITY OF TEXAS AT AUSTIN 53

slide-55
SLIDE 55

DEPARTMENT OF COMPUTER SCIENCES

Processes

Processes typically communicate via channels. For channel , treat :put and :g et as site calls.
  • :g
et is blocking. In our examples, :put is non-blocking. Other kinds of channels can be programmed as sites.

UNIVERSITY OF TEXAS AT AUSTIN 54

slide-56
SLIDE 56

DEPARTMENT OF COMPUTER SCIENCES

Typical Iterative Process

Forever: Read

x from channel , compute with x, output result on e: P ( ; e)
  • :g
et > x > Compute (x) > y > e:put(y )
  • P
( ; e)

Process (network) to read from both

and d and write on e: N et( ; d; e)
  • P
( ; e) j P (d; e)

UNIVERSITY OF TEXAS AT AUSTIN 55

slide-57
SLIDE 57

DEPARTMENT OF COMPUTER SCIENCES

Multiplexor, from Hoare

A mulitiplexor receives messages from several channels, [i℄,
  • i
  • N .
It reproduces all messages on outgoing channel e. It stops reading from a channel after seeing an eos message.

Solution:

mux
  • P
j P 1 j
  • j
P N P i
  • [i℄:g
et > x > if (x6=eos)
  • e:put(x)
  • P
i

UNIVERSITY OF TEXAS AT AUSTIN 56

slide-58
SLIDE 58

DEPARTMENT OF COMPUTER SCIENCES

Example

Run a dialog with the client. Forever: client inputs an integer on channel

p

Process outputs true on channel

q iff it is prime.

Sites:

:g et and :put, for channel . P r ime?(x) returns true iff x is prime. D ial
  • g
(p; q )
  • p:g
et > x > P r ime?(x) > b > q :put(b)
  • D
ial
  • g
(p; q )

UNIVERSITY OF TEXAS AT AUSTIN 57

slide-59
SLIDE 59

DEPARTMENT OF COMPUTER SCIENCES

Push, Pull

  • f
> x > g may run many g in parallel, one for each publication of f . Run one copy of g at any time (iterate g with values from f ):

f may publish at arbitrary speed.

– Start an iteration only on completion of an iteration. – Assume

g publishes at most one value.
  • f writes to channel
.

Read a new value from

  • nly after processing the previous value.
(f > y > :put(y )
  • )
j R g R g
  • :g
et > x > g
  • R
g

UNIVERSITY OF TEXAS AT AUSTIN 58

slide-60
SLIDE 60

DEPARTMENT OF COMPUTER SCIENCES

Mutual Exclusion

Process i writes a site name on channel i. Multiplexor i collects inputs from i, writes on e. Multiplexor i
  • i
:g et > x > e:put(x)
  • Multiplexor
i
  • Ar
biter picks an item g from e; grants resource by calling g. g responds after the process completes the resource usage. Ar biter
  • e:g
et > g > g
  • Ar
biter
  • Mutex coordinates all the activities.
Mutex
  • (
j i :: Multiplexor i ) j Ar biter

UNIVERSITY OF TEXAS AT AUSTIN 59

slide-61
SLIDE 61

DEPARTMENT OF COMPUTER SCIENCES

Dining Philosophers

A philosopher’s life is depicted by

P i
  • (l
et(x; y )
  • E
at
  • F
  • rk
i :put
  • F
  • rk
i :put

where

x:2 F
  • rk
i :g et y :2 F
  • rk
i :g et )
  • P
i

where

F
  • rk
i and F
  • rk
i are sites, returning signals.

Represent the ensemble of

N philosophers by D P
  • (
j i:
  • i
< N : P i )

UNIVERSITY OF TEXAS AT AUSTIN 60

slide-62
SLIDE 62

DEPARTMENT OF COMPUTER SCIENCES

Synchronized Communication: Byzantine Protocol

Process i sends values to j over channel ij . S end i (v )
  • (
j j :: ij :put(v )
  • )
R ead i
  • (l
et(X ) where (8j :: X j :2 j i :g et))
  • R
  • und
i (v ; n): For process i to run n rounds with initial value v. R
  • und
i (v ; 0)
  • l
et(v ) R
  • und
i (v ; n)
  • (S
end i (v ) j R ead i ) > X > Compute i (X ) > u > R
  • und
i (u; n
  • 1)
  • B
y z (V ; n): All processes run n rounds; initial value vector is V . B y z (V ; n)
  • (
j i:: R
  • und
i (V i ; n))

UNIVERSITY OF TEXAS AT AUSTIN 61