messagepassing€¦ · messagepassing inf2140parallelprogramming: chapter10 april10,2013 inf2140...

34
Message Passing INF2140 Parallel Programming: Chapter 10 April 10, 2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Upload: others

Post on 26-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Message Passing

INF2140 Parallel Programming: Chapter 10

April 10, 2013

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 2: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Message Passing

Concepts:synchronous message passing - channelasynchronous message passing - portsend and receive / selective receiverendezvous bidirectional communications

entrycall and accept ... reply

Modelschannel : relabelling, choice, guardsport : message queue, choice, guardsentry : port, channel

Practicedistributed computing (disjoint memory)threads and monitors (shared memory)

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 3: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Synchronous Message Passing: Channel

Channel c Sender send(e,c)

Receiver v=receive(c)

one-to-one

send(e,c) - send the value ofthe expression e to channel c.The process calling the sendoperation is blocked until themessage is received from thechannel.

v = receive(c) - receive avalue into local variable v fromchannel c. The process callingthe receive operation is blockedwaiting until a message is sent tothe channel.

cf. distributed assignment v = e

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 4: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Asynchronous Message Passing: Port

Port p Receiver v=receive(p)

Sender send(e,c) Sender send(e,c) Sender[n] send(en,p)

many-to-one

send(e,p) - send the value ofthe expression e to port p. Theprocess calling the send operationis not blocked. The message isqueued at the port if the receiveris not waiting.

v = receive(p) - receive avalue into local variable v fromport p. The process calling thereceive operation is blocked ifthere are no messages queued tothe port.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 5: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Message Passing in FSP: the earlier buffer example

BUFFER(N=5) = COUNT[ 0 ] ,COUNT[ i : 0 . . N] = (when ( i<N) put −> COUNT[ i +1]

|when ( i >0) get −> COUNT[ i −1 ] ) .

PRODUCER = ( put −> PRODUCER) .CONSUMER = ( get −> CONSUMER) .

| | BOUNDEDBUFFER = (PRODUCER | | BUFFER ( 5 ) | |CONSUMER) .

Here we have seen a a buffered channel which may hold up to 5value, used by a producer and a consumer.Values are abstracted away.We can define asynchronous message passing in a similar fashion,naming the buffer (so that we may involve several ones), andadding values to the messages:

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 6: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Asynchronous Message Passing in FSP: Buffered Channel

We may adjust the example to deal with an explicit (named) buffer:

const N = 5BUFFER = COUNT[ 0 ] ,COUNT[ i : 0 . . N] = (when ( i<N) put −> COUNT[ i +1]

|when ( i >0) get −> COUNT[ i −1])/{ send /put , r e c e i v e / ge t } .

PRODUCER = ( c . send −> PRODUCER) .CONSUMER = ( c . r e c e i v e −> CONSUMER) .

| |BOUNDEDCHAN = (PRODUCER | | CONSUMER | | c : : BUFFER ) .

Note: A one-slot buffer (N = 0) enforces the order send, receive,send, receive, . . . similar to synchronous message passing.And we may add values:

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 7: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Message Passing in FSP: Buffered channel with contentA channel which may hold up to three values:

range X = 0 . . 2CHAN = ( send [ x :X]−>CHAN[ x ] ) , // empty channe lCHAN[ x1 :X ] // one s l o t f i l l e d

= ( send [ x :X]−>CHAN[ x ] [ x1 ]| r e c e i v e [ x1]−>CHAN) ,

CHAN[ x1 :X ] [ x2 :X ] // two s l o t s f i l l e d= ( send [ x :X]−>CHAN[ x ] [ x1 ] [ x2 ]

| r e c e i v e [ x2]−>CHAN[ x1 ] ) ,CHAN[ x1 :X ] [ x2 :X ] [ x3 :X ] // t h r e e s l o t s f i l l e d

= ( r e c e i v e [ x3]−>CHAN[ x1 ] [ x2 ] ) .PROD = ( c . send [0]−>c . send [1]−>c . send [2]−>PROD)

+{c . r e c e i v e [X ] } .CONS = ( c . r e c e i v e [ v :X]−>CONS)+{c . send [X ] } .| | SYS = ({p , q } :PROD| | { r , s } :CONS | | { p , q , r , s } : : c :CHAN) .

Note: The channel is shared by many producers and many receivers!INF2140 Parallel Programming: Chapter 10

Message Passing

Page 8: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Synchronous Message Passing in FSP: Unbufferd channelPROD and CONS as above with an unbufferd channel (no slots):

range X = 0 . . 2CHAN = ( t r a n s [ x :X]−>CHAN) . // t r a n s f e r w i thout s t o r i n g

PROD = ( c . send [0]−>c . send [1]−>c . send [2]−>PROD)/{ c . t r a n s /c . send } .

CONS = ( c . r e c e i v e [ v :X]−>CONS)/{ c . t r a n s /c . r e c e i v e } .

| | SYS = ({p , q } :PROD| | { r , s } :CONS | | { p , q , r , s } : : c :CHAN)/{ p . { r , s } . c . t r a n s /p . c . t r an s ,

q . { r , s } . c . t r a n s /q . c . t r an s ,{p , q } . r . c . t r a n s / r . c . t r an s ,{p , q } . s . c . t r a n s / s . c . t r a n s } .

Note: The channel is shared by many producers and many receivers!Note: The channel process {p, q, r , s} :: c : CHAN is here redundant!

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 9: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Challenges in Java

asynchronous communication?synchronous communication ?

Solution: Shared objects and monitors.selection

Solution: class Selectable (by the authors) to handle a version ofthe select statement.

class Select to handle a select statement.class Selectable to handle choices in a select statement,including a guard.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 10: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Synchronous Message Passing: Applet

A sender communicateswith a receiver using asingle channel.

The sender sends asequence of integer valuesfrom 0 to 9 and thenrestarts at 0 again.

Channel <Integer > chan = new Channel <Integer >();tx.start(new Sender(chan ,senddisp ));rx.start(new Receiver(chan ,recvdisp ));

tx,rx: Instances of ThreadPanelsenddisp,recvdisp: Instances of SlotCanvas

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 11: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Synchronous Channel

public class Channel <T> extends Selectable {T chan_ = null;

public synchronized void send(T v)throws InterruptedException {

chan_ = v;signal();while (chan_ != null) wait ();

}public synchronized T receive ()

throws InterruptedException {block();T tmp = chan_; chan_ = null;notify (); // notifyAll () not needed.return(tmp);

}}

Blue methods are from class Selectable.

The implementation ofChannel is a monitor withsynchronized access methodsfor send and receive.

Selectable is described later.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 12: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

class Selectable – representing guarded choices in a selectclass Selectable { private boolean open = false;private boolean guard_ = true;private int ready = 0; private Select inchoice = null;void setSelect(Select s) {inchoice = s;}synchronized void block() throws InterruptedException{

if (inchoice == null) { open ();while(ready ==0) wait (); close (); clearReady ();}

synchronized void signal () {if (inchoice == null)

{ ++ ready; if (open) notifyAll (); }else { synchronized (inchoice)

{ ++ ready; if (open) inchoice.notifyAll ();}}}boolean testReady () {return ready >0;}synchronized void clearReady () { --ready ;}public void guard(boolean g) { guard_=g; }boolean testGuard (){ return guard_ ;} }void open() { open=true;}void close() { open=false ;}

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 13: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Sender

class Sender implements Runnable {private Channel <Integer > chan;private SlotCanvas display;Sender(Channel <Integer > c, SlotCanvas d)

{chan=c; display=d;}

public void run() {try { int ei = 0;

while(true) {display.enter(String.valueOf(ei));ThreadPanel.rotate (12);chan.send(new Integer(ei));display.leave(String.valueOf(ei));ei=(ei +1)%10; ThreadPanel.rotate (348);}

} catch (InterruptedException e){}}

}

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 14: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Receiver

class Receiver implements Runnable {private Channel <Integer > chan;private SlotCanvas display;Receiver(Channel <Integer > c, SlotCanvas d)

{chan=c; display=d;}

public void run() {try { Integer v=null;

while(true) {ThreadPanel.rotate (180);if (v!=null) display.leave(v.toString ());v = chan.receive ();display.enter(v.toString ());ThreadPanel.rotate (180); }

} catch (InterruptedException e){}}

}

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 15: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Model

range M = 0..9 // messages with values up to 9

SENDER = SENDER [0], // shared channel chanSENDER[e:M] = (chan.send[e]-> SENDER [(e+1)%10]).

RECEIVER = (chan.receive[v:M]-> RECEIVER ).

// relabeling to model synchronization|| SyncMsg = (SENDER || RECEIVER)

/{chan/chan.{send ,receive }}.

How can this be modeleddirectly without the needfor relabeling?

message operation FSP modelsend(e,chan) chan.[e]v = receive(chan) chan.[v:M]

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 16: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Selective Receive

Channels c1 c2 cn

How should we deal with multiple channels?

Sender send(e,c) Sender send(e,c) Sender[n] send(en,cn)

Selectstatement...

How wouldwe modelthis in FSP?

selectwhen G1 and v1=receive(chan1) => S1;

orwhen G2 and v2=receive(chan2) => S2;

or...

orwhen Gn and vn=receive(chann) => Sn;

end

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 17: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Selective Receive

ARRIVALS CARPARK CONTROL

DEPARTURES arrive depart

CARPARK

CARPARKCONTROL(N=4) = SPACES[N],SPACES[i:0..N] = (when(i > 0) arrive ->SPACES[i-1]

|when(i < N) depart ->SPACES[i+1]).ARRIVALS = (arrive ->ARRIVALS ).DEPARTURES = (depart ->DEPARTURES ).|| CARPARK = (ARRIVALS || CARPARKCONTROL (4)|| DEPARTURES ).

Interpret as channels

Implementation using message passing?INF2140 Parallel Programming: Chapter 10

Message Passing

Page 18: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

class Select – implementing choice

A select object has a list of selectable objects, and can selectone of these when all are ready to make a choice, by a methodchoose.After the choice has been made, all the selectable objects mustbecome available for a new choice by updating their internaland external guards.Method choose can get suspended if(a) not all selectable objects are ready to make a choice(b) no selectable object is enabled

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 19: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

class Select – implementing choiceclass Select { ArrayList <Selectable > list

= new ArrayList <Selectable >(2);public void add(Selectable s)

{list.add(s); s.setSelect(this); }private void clearAll ()

{for (Selectable s:list) {s.close ();}}private void openAll () {for (Selectable s:list)

{if (s.testGuard ()) s.open ();}}private int testAll (){ int i=1; for(Selectable s:list)

{if(s.testReady ()&& s.testGuard ()) return i; ++i;}return 0;}

public synchronized int choose()throws InterruptedException {int readyIndex = 0;

while (readyIndex ==0) {readyIndex=testAll ();if(readyIndex ==0) {openAll (); wait (); clearAll ();}}

return readyIndex ;}}

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 20: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Selective Receive

class MsgCarPark implements Runnable {private Channel <Signal > arrive ,depart;private int spaces ,N;private StringCanvas disp;

public MsgCarPark(Channel <Signal > a,Channel <Signal > l,StringCanvas d,int capacity) {

depart=l; arrive=a; N=spaces=capacity; disp=d;}...public void run() {...}

}

Implement CARPARKCONTROL as a thread MsgCarPark whichreceives signals from channels arrive and depart.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 21: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Selective Receive

public void run() {try {

Select sel = new Select ();sel.add(depart ); sel.add(arrive );while(true) {

ThreadPanel.rotate (12);arrive.guard(spaces >0);depart.guard(spaces <N);switch (sel.choose ()) {case 1: depart.receive (); display (++ spaces );

break;case 2: arrive.receive (); display(--spaces );

break;}}

} catch InterrruptedException {}} See Applet!

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 22: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Asynchronous Message Passing: Port

Port p Receiver v=receive(p)

Sender send(e,c) Sender send(e,c) Sender[n] send(en,p)

many-to-one

send(e,p) - send the value ofthe expression e to port p. Theprocess calling the send operationis not blocked. The message isqueued at the port if the receiveris not waiting.

v = receive(p) - receive avalue into local variable v fromport p. The process calling thereceive operation is blocked ifthere are no messages queued tothe port.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 23: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Asynchronous Message Passing: Applet

Two senders communicatewith a receiver via an“unbounded” port.

Each sender sends asequence of integer valuesfrom 0 to 9 and thenrestarts at 0 again.

Port <Integer > port = new Port <Integer > ();tx1.start(new Asender(port ,send1disp ));tx2.start(new Asender(port ,send2disp ));rx.start(new Areceiver(port ,recvdisp ));

Instances of ThreadPanel Instances of SlotCanvas

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 24: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Port

class Port <T> extends Selectable {Queue <T> queue = new LinkedList <T>();

public synchronized void send(T v){queue.add(v);signal (); // part of Selectable

}public synchronized T receive ()

throws InterruptedException {block (); // part of Selectablereturn queue.remove ();

}}

The implementation of Port is a monitor that hassynchronized access methods for send and receive.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 25: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Port Model

range M = 0..9 // messages with values up to 9set S = {[M],[M][M]} // queue up to three messages

PORT //empty state , only send permitted= (send[x:M]->PORT[x]),

PORT[h:M] //one message queued to port= (send[x:M]->PORT[x][h]

|receive[h]->PORT),PORT[t:S][h:M] //two or more messages queued to port

= (send[x:M]->PORT[x][t][h]|receive[h]->PORT[t]).

// minimise to see result of// abstracting from data values||APORT = PORT/{send/send[M],receive/receive[M]}.

LTS? What happens if we can send 4 values?

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 26: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Model of the Applet

S[1..2]: ASENDER port:PORT ARECEIVER

AsynchMsg

port.receive S[1..2].port.send

ASENDER = ASENDER [0],ASENDER[e:M] = (port.send[e]->ASENDER [(e+1)%10]).

ARECEIVER = (port.receive[v:M]->ARECEIVER ).

|| AsyncMsg = (s[1..2]: ASENDER || ARECEIVER ||port:PORT)/{s[1..2]. port.send/port.send}.

Safety?

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 27: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Rendezvous: Entry

Rendezvous is a form of request-reply to support client servercommunication. Many clients may request service, but only one isserviced at a time.

Client Server

req=accept(entry)

res=call(entry,req)

reply(entry,res)

Request message

Reply message

suspended perform service

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 28: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Rendezvous

res=call(e,req) - send thevalue req as a request messagewhich is queued to the entry e.

The calling process is blockeduntil a reply message is receivedinto the local variable req.

req=accept(e) - receive the valueof the request message from theentry e into local variable req. Thecalling process is blocked if there areno messages queued to the entry.

reply(e,res) - send the value resas a reply message to entry e.

The model and implementation use a port for one direction and achannel for the other. Which is which?

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 29: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Rendezvous: Applet

Two clients call aserver which servicesone request at a time.

Entry <String ,String > entry = new Entry <String ,String > ();clA.start(new Client(entry ,clientAdisp ,"A"));clB.start(new Client(entry ,clientBdisp ,"B"));sv.start(new Server(entry ,serverdisp ));

Instances of ThreadPanel Instances of SlotCanvasINF2140 Parallel Programming: Chapter 10

Message Passing

Page 30: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Entry

Entries are implemented asextensions of ports, therebysupporting queuing andselective receipt.

The call method creates achannel object on which toreceive the reply message. Itconstructs and sends to theentry a message consisting ofa reference to this channeland a reference to the reqobject. It then awaits thereply on the channel.

The accept method keeps a copy ofthe channel reference; the replymethod sends the reply message tothis channel.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 31: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Java Implementation: Entry

class Entry <R,P> extends Port <R> {private CallMsg <R,P> cm;private Port <CallMsg <R,P>> cp = new Port <CallMsg <R,P>>();

public P call(R req) throws InterruptedException {Channel <P> clientChan = new Channel <P>();cp.send(new CallMsg <R,P>(req ,clientChan ));return clientChan.receive ();

}public R accept () throws InterruptedException {

cm = cp.receive (); return cm.request; }public void reply(P res) throws InterruptedException {

cm.replychan.send(res); }

private class CallMsg <R,P> {R request; Channel <P> replychan;CallMsg(R m, Channel <P> c){ request=m; replychan=c;}

}} Do call, accept, and reply need to be synchronized methods?

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 32: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Model of Entry and Applet

We reuse themodels for portsand channels...

CLIENT() entry:ENTRY SERVER

EntryDemo

entry.accept entry.call[M]

set M = {replyA ,replyB} // reply channels

||ENTRY = PORT/{call/send , accept/receive }.

CLIENT(CH=’reply) = (entry.call[CH]->[CH]->CLIENT ).

SERVER = (entry.accept[ch:M]->[ch]->SERVER ).

|| EntryDemo = (CLIENT(’replyA )|| CLIENT(’replyB)|| entry:ENTRY || SERVER ).

Action labels used in expressions or as parameter

values must be prefixed with a single quote.

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 33: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Rendezvous vs Monitor Method Invocation

What is the difference?from the point of view of the client?from the point of view of the server?mutual exclusion?

Which implementation is more efficient?in a local context (client and server in same computer)?in a distributed context (in different computers)?

INF2140 Parallel Programming: Chapter 10

Message Passing

Page 34: MessagePassing€¦ · MessagePassing INF2140ParallelProgramming: Chapter10 April10,2013 INF2140 Parallel Programming: Chapter 10 Message Passing

Message Passing: Summary

Concepts:synchronous message passing - channelasynchronous message passing - portsend and receive / selective receiverendezvous bidirectional comms - entrycall and accept ... reply

Modelschannel : relabelling, choice, guardsport : message queue, choice, guardsentry : port, channel

Practicedistributed computing (disjoint memory)threads and monitors (shared memory)

INF2140 Parallel Programming: Chapter 10

Message Passing