Inter process Communication (IPC)

 

Mechanism for processes to communicate and to synchronize their actions.

Message system – processes communicate with each other without resorting to shared variables.

IPC facility provides two operations:

  1. send (message) – message size fixed or variable

  2. receive (message)

If P and Q wish to communicate, they need to: establish a communication link between them           exchange messages via send/receive  Implementation of communication link

  1. physical (e.g., shared memory, hardware bus)

  2. logical (e.g., logical properties)

 

Implementation Questions

 

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

 

Processes must name each other explicitly:

  1.  send (P, message) – send a message to process P

  2.  receive (Q, message) – receive a message from process Q  Properties of communication link

  3.  Links are established automatically.

  4.  A link is associated with exactly one pair of communicating processes.

  5.  Between each pair there exists exactly one link.

  6.  The link may be unidirectional, but is usually bi-directional.

 

Indirect Communication

 

Messages are directed and received from mailboxes (also referred to as ports).

  1.  Each mailbox has a unique id.

  2.  Processes can communicate only if they share a mailbox.

Properties of communication link

  1. Link established only if processes share a common mailbox

  2. A link may be associated with many processes.

Each pair of processes may share several communication links.

  1. Link may be unidirectional or bi-directional.

 

Indirect Communication

 

Operations

  1. create a new mailbox

  2. send and receive messages through mailbox

  3. destroy a mailbox

Primitives are defined as:

Send (A, message) – send a message to mailbox A

receive (A, message) – receive a message from mailbox A

 

Indirect Communication

 

Mailbox sharing

  1.  P1, P2, and P3 share mailbox A.

  2.  P1, sends; P2 and P3 receive.

Who gets the message?

Solutions

  1. Allow a link to be associated with at most two processes.

  2. Allow only one process at a time to execute a receive operation.

  3. Allow the system to select arbitrarily the receiver. Sender is notified who the receiver was.

 

Synchronization

 

Message passing may be either blocking or non-blocking.

Blocking is considered synchronous

Non-blocking is considered asynchronous

send and receive primitives may be either blocking or non-blocking.

 

Buffering

 

Queue of messages attached to the link; implemented in one of three ways.

  1. Zero capacity – 0 messages

      Sender must wait for receiver (rendezvous).

  2. Bounded capacity – finite length of n messages Sender must wait if link full.

  3. Unbounded capacity – infinite length

      Sender never waits.

 

                                                                                                                                                                                                             BACK