Sie sind auf Seite 1von 3

how are links established?

Naming of links - direct and indirect communications


Direct: Each process wanting to communicate must explicitly name the recipient or sender of the
communication .
send and receive primitives defined:
send ( P, message ) : send a message to process P
receive ( Q, message )
: receive a message from process Q
a link established automatically between every pair of processes that want to communicate
processes only need to know each others identity.
link is usually bidirectional but can be unidirectional
Process A
Process B
while (TRUE) {
while (TRUE) {
produce an item
receive ( A, item )
send ( B, item )
consume item
}
}
Asymmetric addressing:
only the sender names the recipient
recipient not required to name the sender - need not know the sender
send ( P, message ) : send message to process P
receive ( id, message )
: receive from any process, id set to sender
Disadvantage of direct communications :
limited modularity - changing the name of a process means changing every sender and receiver
process to match , need to know process names .

Indirect communications :
messages sent to and received from mailboxes (or ports)
mailboxes can be viewed as objects into which messages placed by processes and from which
messages can be removed by other processes
each mailbox has a unique ID
two processes can communicate only if they have a shared mailbox
send ( A, message ) : send a message to mailbox A
receive ( A, message ): receive a message from mailbox A
a communications link is only established between a pair of processes if they have a shared mailbox
a pair of processes can communicate via several different mailboxes if desired
a link can be either unidirectional or bidirectional
can a link be associated with more than two processes?
Direct Communication:link is associated with exactly two processes.
Inasymmetric addressing: reciever can recieve from any process but only one reciever.

Indirect Communication:
a link may be associated with more than two processes
allows one-to-many, many-to-one, many-to-many communications

one-to-many : any of several processes may receive from the mailbox


e.g. a broadcast of some sort
only allow one process at a time to wait on a receive
many-to-one : many processes sending to one receiving process
e.g. a server providing service to a collection of processes
file server, network server, mail server etc.
receiver can identify the sender from the message header contents
many-to-many :
e.g. multiple senders requesting service and a pool of receiving servers offering service - a server
farm
how many links can there be between every pair of processes?
many.
what is the capacity of a link?
Buffering - the number of messages that can reside in a link temporarily
Zero capacity - queue length 0
sender must wait until receiver ready to take the message
Bounded capacity - finite length queue
messages can be queued as long as queue not full
otherwise sender will have to wait
Unbounded capacity
any number of messages can be queued - in virtual space.
sender never delayed
fixed v. variable length messages ?
Fixed-length messages:
simple to implement - can have pool of standard-sized buffers
low overheads and efficient for small lengths
copying overheads if fixed length too long
can be inconvenient for user processes with variable amount of data to pass
may need a sequence of messages to pass all the data
long messages may be better passed another way e.g. FTP
copying probably involved, sometimes multiple copying into kernel and out
Variable-length messages:
more difficult to implement - may need a heap with garbage collection
more overheads and less efficient, memory fragmentation
more convenient for user processes

unidirectional v. bidirectional ?
Direct Communication:Can be either.
Indirect Communication: Can be either.

Das könnte Ihnen auch gefallen