How are links established? ± Can a link be associated with more than 2 processes? ± How many links can there be between every pair of communicating processes? ± What is the capacity of a link? ± Fixed or variable size messages? ± Unidirectional or bidirectional links? …….
Direct Communication ° Sender and Receiver processes must name each other explicitly: ± send ( P , message ) - send a message to process P ± receive ( Q , message ) - receive a message from process Q Properties of communication link: ° ± Links are established automatically. ± A link is associated with exactly one pair of communicating processes. ± Exactly one link between each pair. ± Link may be unidirectional, usually bidirectional.
Indirect Communication ° Messages are directed to and received from mailboxes (also called ports) ² Unique ID for every mailbox. ² Processes can communicate only if they share a mailbox. Send ( A , message ) /* send message to mailbox A */ Receive ( A , message ) /* receive message from mailbox A */ ° Properties of communication link ² Link established only if processes share a common mailbox. ² Link can be associated with many processes. ² Pair of processes may share several communication links ² Links may be unidirectional or bidirectional
Indirect Communication using mailboxes
Mailboxes (cont.) ° Operations ² create a new mailbox ² send/receive messages through mailbox ² destroy a mailbox ° Issue: Mailbox sharing P1, P2 and P3 share mailbox A. ² ² P1 sends message, P2 and P3 receive… who gets message?? ° Possible Solutions ² disallow links between more than 2 processes ² allow only one process at a time to execute receive operation ² allow system to arbitrarily select receiver and then notify sender.
Message Buffering ° Link has some capacity - determine the number of messages that can reside temporarily in it. ° Queue of messages attached to link ± Zero-capacity Queues: 0 messages ² sender waits for receiver (synchronization is called rendezvous ) ± Bounded capacity Queues: Finite length of n messages ² sender waits if link is full ± Unbounded capacity Queues: Infinite queue length ² sender never waits
Message Problems - Exception Conditions ± Process Termination ° Problem: P(sender) terminates, Q(receiver) blocks forever. ± Solutions: ² System terminates Q. ² System notifies Q that P has terminated. ² Q has an internal mechanism(timer) that determines how long to wait for a message from P. ° Problem: P(sender) sends message, Q(receiver) terminates. In automatic buffering, P sends message until buffer is full or forever. In no-buffering scheme, P blocks forever. ± Solutions: ² System notifies P ² System terminates P ² P and Q use acknowledgement with timeout
Message Problems - Exception Conditions ° Lost Messages ² OS guarantees retransmission ² sender is responsible for detecting it using timeouts ² sender gets an exception Scrambled Messages ° ± Message arrives from sender P to receiver Q, but information in message is corrupted due to noise in communication channel.
- One '20