Inter-Process Communication (IPC) in Operating System:

Sometimes cooperating processes may need to communicate with each other without using a shared buffer. This can be achieved by allowing processes to send messages to each other through some form of message passing system. Note that a message passing system and a shared buffer are not mutually exclusive. Inter-process communication can be used for processes to communicate or to synchronize their actions.


An IPC facility provides two operations of sending and receiving message. If two process wish to communicate they need to:

  • Establish a communication link between them.
  • Exchange messages using the send and receive operations.

There must be some form of communication link between processes like such as shared memory or a hardware bus.

Implementation Questions:

There are several implementation questions that need to be asked about communication links between processes. Some of these are:
  • How are links established?
  • Can a link be associated with more than two processes.
  • How many links can there be between every pair of communicating processes?
  • What is the capacity of a link?
  • Is the size of a message that the link can accommodate fixed or variable?
  • Is a link unidirectional or bi-directional?

Direct Communication:

In direct communication, processes that wish to communicate with each other must know each other's names. When they communicate, they must name each other explicitly. Otherwise, the message may not be delivered correctly. The two operations in a direct communication system may be defined as:

  • Send (ProcessName, message)
  • Receive (ProcessName, message)

The links in a direct communication environment are established automatically. A link is associated with exactly one pair of communicating processes, and between each pair there exists only one link. The link may be unidirectional or bi-directional.

Indirect Communication:

In indirect communication, messages are received from mailboxes also known as ports. Each mailbox has a unique ID. Processes can communicate only if they share a mailbox.


The links in an indirect communication environment are established only if processes share a common mailbox. A link may be associated with many processes and each pair of processes may share several communication links. The links may be unidirectional or bidirectional. In addition, some extra operations are needed:


  • Create a new mailbox.
  • Send and receive messages through a mailbox.
  • Delete a mailbox.



Some problems with the mailbox system occur when more than two processes share a mailbox. Process 1 sends a message to a mailbox that it shares with Process 2 and Process 3. Process 2 and Process 3 both try to receive the message. Who gets it?


Some solutions to the above problem are:

  • To allow a link to be established with at most two processes.
  • To allow only one process at a time to execute a receive operation.
  • To allow the system to arbitrarily select the receiver (the sender must be notified who received the message).



Buffering:

If many messages are sent at once and we do not want to lose messages, the link may have a buffer attached to it. A buffer is just like a queue of messages. The buffer may have one of three properties:


Zero Capacity: 0 messages can be stored in the buffer. The sender must wait for the receiver to respond (rendezvous).


Bounded Capacity: Finite length of n messages. Sender must wait if the buffer is full.


Unbounded Capacity: Infinite number of messages may be stored. The sender never has to wait.

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Blog Archive

Powered by Blogger.

- Copyright © 2013 Taqi Shah Blogspot -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -