Interprocess Communication (IPC) and its methods

By | September 28, 2021

Inter-process Communication (IPC)

  • Inter-process Communication (IPC) is a facility provided by an operating system via which cooperating processes can communicate with each other.
  • IPC facility allows the processes to cooperate and synchronize their actions without sharing the same address space.
  • IPC is particularly useful in a distributed environment where the communicating processes may reside on different computers connected with a network. An example is a chat program used on the World Wide Web.

There are several different methods for establishing interprocess communication. Some of these methods are :

  1. Message passing
  2. Shared memory 
  3. Signals 
  4. Shared files, i.e. Pipes
  5. Dynamic Data Exchange (DDE)
  6. Object Linking and Embedding (OLE)
  7. Sockets

1. Message Passing Model

  • A message is a collection of information that may be exchanged between a sending and a receiving process.
  • A message may contain data, execution commands, or even some code to be transmitted between two or more process.
  • A message is characterized by its type, length, sender and receiver IDs and a data field.
  • A message format is flexible and negotiable by each sender-receiver pair.

General Message Format in Message Passing Model - Interprocess Communication

Message Format

  • The format of a message depends upon two factors :
  1. The objectives of the message facility.
  2. Whether the facility runs on a single computer or on a distributed system.

Implementation issues in messages

The various implementation issues that arise in interprocess communication using messages are:

1. Naming of the sender and receiver processes : Naming conventions used in the send and receive calls provide answers to some key questions

(i) How does the sender process know the name of the receiver ?

(ii) How does the receiver process know the name of sender ?

2. Message delivery protocols : Protocols are the set of rules that determine the message data formats and actions of processes while sending and receiving messages.

3. Operating system responsibilities : Buffering of messages, blocking and waking of processes etc.

2. Shared Memory Model

  • Normally, processes use memory areas within the scope of virtually memory space. Also memory management systems ensure that every process has a well-defined and separate data and code area.
  • In shared memory model parts of private address space of two or more are processes are mapped to same physical memory.
  • Such memory areas are called shared memory regions.
  • Shared memory locations provide another methods for sharing information between the processes and thus serve as mechanism of IPC.

Shared memory space, Shared Memory Model - Interprocess Communication


  • For this, computer hardware should support the shared memory segments a operating system helps processes in creating and destroying shared memory regions.
  • Some operating system support a supervisor call that creates a shared memory space.

3. Signals

  • A signal is a primitive form of communication that is used to alert a process to the occurrence of some event.
  • Majority of signals are sent from the kernel to user processes, but some can be sent from one user process to another thus providing inter process communication.
  • For example, in UNIX, two user defined signals that are used by user processes are SIGUSR1 and SIGUSR2.
  • In order to kill another process, a process can send SIGKILL signal or SIGTERM signal.

4. Pipes

  • A pipe is an another technique used for inter process communication (IPC).
  • A pipe is a mechanism by which the output of one process is directed into the input of another process. Thus it provides one way flow of data between two related processes.
  • In pipes, a temporary intermediate file is created into which the first process writes its output (data) and from which the second process reads its input (data) out of the pipe.

Representation of a pipe

  • Although pipe can be accessed like an ordinary file, the system actually manages it as FIFO queue.
  • A pipe file is created using the pipe system call.


  • A FIFO is a named pipe used as a permanent file in UNIX.
  • FIFO pipe operates on the basis of first-in-first-out order and are managed as buffers from within the kernel.
  • A FIFO can be created by the mknod shell command or system call. ‘mknod‘ stands for make node and is used to create non regular directory entries such as special files (device entries), directories and FIFOS.
  • A FIFO is an empty file.

A typical command to create a FIFO is :

$/etc/mknode npipe P

The parameter P specifies that a pipe is required. An entry will now appear in the current directory:

$ls -1 npipe

prw-rw-rw-1 ritchie staff O Aug 15 10:26 npipe

  • The ‘p’ in the first position indicates that it is named pipe. The zero indicates the current file size i.e. as one would expect, it is empty.
  • A FIFO offers the same communication facility as the unnamed pipe and has a name in the file system so that it can be accessed like a file. This allows the named pipe to be used between unrelated processes.

6. Dynamic Data Exchange (DDE)

  • DDE was introduced by Microsoft as a mean of transferring data between two windows applications.
  • The mode of operation of DDE is just like a conversation between two people where one person begins by asking question. At the end of the question, questioner stops and waits for the answer.
  • This mode of working is called dynamic because both sides in the conservation are actively participating throughout the duration of the communication session.
  • The requester is called the client and the other is called server.
  • Conservation in DDE can be asynchronous or synchronous.

Dynamic Data Exchange (DDE) Conversation

  • In asynchronous conservation, the client sends a request and waits until the server responds.
  • In synchronous conservation, the client sends a request then awaits a response.
  • As shown in figure, the client can initiate a conservation, sends commands, request data, send data and close a conservation. The server obeys commands, supplies information, accepts information and can close a conservation.

7. Object Linking and Embedding

  • OLE technique was developed in Microsoft Windows operating system.
  • The purpose of original OLE was to enable integration of application ‘objects‘ from different but complaint software packages.
  • OLE consists of two mechanism – linking and embedding.

Interprocess communication and its methods

  • With linking the source documents contains only a reference to the object; the object exists separately. This reference specifies the name and location (directory pathname) of the object file and associated application (e.g. excel, word etc.).
  • With embedding the object is actually stored as a part of the data of the source document.

8. Socket

  • The socket mechanism provides a means of inter-process communication (IPC) by establishing named contact points between which the communication take place.
  • Thus, a socket is defined as an endpoint for communication.
  • Two processes that are two different computer system (connected via network) can exchange messages using socket.
  • Like pipe is used to create pipes, socket is created using socket system call.
  • We can also say that socket provides bidirectional FIFO communication facility over the network.
  • A pair of processes communicating over a network employs a pair of socket- one for each process.

Thus, a socket connecting to the network is created at each end of the communication and when sockets are inter-connected a dialogue can take place.

Socket Address

  • Each socket has a specific address. This address is composed of an IP address and a port number.
  • The nature of the address depends on the communication domain (i.e. UNIX domain. the Internet domain, etc.) of the socket.
  • It is the property of domain that a number of processes communicating in the same domain use the same property of a domain that a number of processes communicating in the same domain use the same address format.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *