Operating systems provide the means for cooperating processes to communicate with each other via an interprocess communication (PC) facility.
IPC provides a mechanism to allow processes to communicate and to synchronize their actions.IPC is best provided by a message passing system.
If processes P and Q want to communicate, they must send messages to and receive messages from each other; a communication link must exist between them.
Physical implementation of the link is done through a hardware bus , network etc,
There are several methods for logically implementing a link and the operations:
1. Direct or indirect communication
2. Symmetric or asymmetric communication
3. Automatic or explicit buffering
4. Send by copy or send by reference
5. Fixed-sized or variable-sized messages
Processes that want to communicate must have a way to refer to each other.
They can use either direct or indirect communication.
1.1. Direct Communication
Each process that wants to communicate must explicitly name the recipient orsender of the communication.
A communication link in this scheme has the following properties:
A link is established automatically between every pair of processes that want to communicate. The processes need to know only each other's identity to communicate.
A link is associated with exactly two processes.
Exactly one link exists between each pair of processes.
There are two ways of addressing namely
Symmetry in addressing
Asymmetry in addressing
In symmetry in addressing, the send and receive primitives are defined as:
send(P, message) Send a message to process P
receive(Q, message) Receive a message from Q
In asymmetry in addressing , the send & receive primitives are defined as:
send (p, message) send a message to process p
receive(id, message) receive message from any process,
id is set to the name of the process with which communication has taken place
1.2. Indirect Communication
With indirect communication, the messages are sent to and received from mailboxes,or ports.
The send and receive primitives are defined as follows:
send (A, message) Send a message to mailbox A.
receive (A, message) Receive a message from mailbox A.
A communication link has the following properties:
A link is established between a pair of processes only if both members of the pair have a shared mailbox.
A link may be associated with more than two processes.
A number of different links may exist between each pair of communicating processes, with each link corresponding to one mailbox
A link has some capacity that determines the number of message that can reside in it temporarily. This property can be viewed as a queue of messages attached to the link.
There are three ways that such a queue can be implemented.
Zero capacity: Queue length of maximum is 0. No message is waiting in a queue. The sender must wait until the recipient receives the message. (Message system with no buffering)
Bounded capacity: The queue has finite length n. Thus at most n messages can reside in it.
Unbounded capacity: The queue has potentially infinite length. Thus any number of messages can wait in it. The sender is never delayed.
Message passing may be either blocking or non-blocking.
Blocking Send - The sender blocks itself till the message sent by it is received by the receiver.
Non-blocking Send - The sender does not block itself after sending the message but continues with its normal operation.
Blocking Receive- The receiver blocks itself until it receives the message.
Non-blocking Receive–The receiver does not block itself.
There are two levels of communication
Low – level form of communication – eg. Socket
High – level form of communication – eg.RPC , RMI
Copyright © 2018-2021 BrainKart.com; All Rights Reserved. (BS) Developed by Therithal info, Chennai.