• Skip to main content
  • Skip to primary sidebar
  • Computer Architecture
  • Computer Networks
  • DBMS
  • OS
  • Software Engineering
  • Security
  • OOT
binary-terms-logo

Binary Terms

The Computer Science & IT Guide

Interprocess Communication (IPC)

30th December 2022 by Neha T Leave a Comment

Interprocess communication takes place between the cooperating processes. These processes communicate with each other by sharing data and information.

Although there occur some issues while establishing interprocess communication. We will discuss those issues along with their solution. We will also discuss ways to achieve interprocess communication.

Content: Interprocess Communication in Operating System

  1. What is Interprocess Communication (IPC)?
  2. Need for Interprocess Communication
  3. Issues in Interprocess Communication
  4. Methods of Interprocess Communication

Define Interprocess Communication (IPC)

Interprocess communication is communication between two processes that may be on the same system or on a different system. If we talk about the process in the operating system, they are of two types:

  1. Independent Process
  2. Cooperating Process

An Independent process is one that doesn’t get affected by the other processes running in the system. It doesn’t even affect the processing of any other process in the system. This is because the independent process doesn’t share any data with the other process.

The cooperating process is one that shares data with the other processes in the system. Thus, it can get affected by the other processes of the system. And even it can affect the working of other processes.

So, among these two processes, the cooperating process requires interprocess communication.

Need of Interprocess Communication

The cooperating process shares its data and information with the other processes. The reason behind this interprocess communication is:

  • Information Sharing
    Several processes may need to access the same piece of information. The mechanism of IPC allows different processes to share the same information concurrently.
  • Computation Speedup
    Small computations execute faster. Thus, if you want to execute a certain task faster. Then break the task into smaller sub-tasks. Now the interprocess communication mechanism lets these subtasks run in parallel.
    But to speed up such tasks, the system must have multiple processing elements. Such as multiple processing units or I/O channels.
  • Modularity
    The interprocess communication mechanism allows the construction of a modern system. Where the functions of the system can be divided into separate processes and threads.
  • Convenience
    A computer user can perform several tasks simultaneously. Such as editing a document, printing a document, playing music etc.

Thus, we need IPC to share data and information between the cooperating processes.

Issues in Interprocess Communication

The issues related to interprocess communication are as below:

  1. How the two cooperating processes can exchange data or information.
  2. None of the communicating processes must come in each other way while executing.
  3. If there is dependency among the processes. Then the operating system must perform proper sequencing.

These are the three generic issues that processes face during interprocess communication.

The same sort of problems or issues arises in the case of threads. As the same problems exist for processes and threads. The same solutions are applicable to them.

Well, these problems are resolved by the models discussed in the section below.

Methods of Interprocess Communication

There are two methods or two models that operating systems can implement to achieve IPC.

  1. Shared Memory
  2. Message Passing

Some operating systems implement both of these models. Let us study these models in more detail.

Shared Memory System

The operating system implementing the shared memory model is a shared memory system. Here a cooperating process creates a shared memory segment in its address space. Now, if there occurs another process that wants to communicate with this process. Then it must attach itself to the created shared memory segment.

Shared Memory Interprocess Communication Model

The communicating processes share information by:

  • Writing data to the shared region
  • Reading from the shared region.

Note: Operating system does not allow a process to access the memory of other processes.

But in a shared memory system, the process can access the memory of other processes. If two or more processes are ready to remove this restriction.

The format of the data to be shared and its location are totally under the control of the processes. The communicating processes must not write to the same shared location at the same time.

How the shared memory system resolves the issues of interprocess communication?

To understand this, let us discuss the producer-consumer problem. This is the most common paradigm for reflecting the issue of cooperating processes.

The producer-consumer problem state that:

There is a producer process, a consumer process and a fixed-size buffer.

  • This buffer is in the critical section, which means only one process can access the buffer at a time.
  • Here the producer can produce data only if the buffer is not full.
  • And the consumer can consume data only if the buffer is not empty.

The buffer should be in a shared memory region of producer and consumer processes to resolve the issue. This allows the producer and consumer processes to access the buffer concurrently.

Thus, the producer process can produce the data onto the buffer. And at the same time, the consumer process can consume the data from the buffer. Along with this, both the producer and consumer processes must be synchronized. So that the consumer should not try to consume the data that the producer process has not yet produced.

Message Passing System

The message-passing system lets the cooperative processes communicate through a message-passing facility.

Message Passing Interprocess Communication Model

The message-passing system is more useful in the distributed environment. As in the distributed environment, the communicating processes may be running on different systems. And these systems are connected via a network.

The message-passing system facilitates communication via at least two operations. That sends messages and receives messages. Although the size of the message can be variable, or it can be of a fixed size.

With the fixed-size messages, the system-level implementation becomes simple. But the programming of such a system becomes difficult.

With the variable size messages, the system-level implementation is difficult. But the programming of such a system becomes simpler.

The message passing can either be:

  1. Synchronous
  2.  Asynchronous.
Synchronous Message Passing System

In synchronous message passing, the sender is blocked until the receiver receives the message. And the receiver is blocked until the message is available.

Asynchronous Message Passing System

In asynchronous message passing, the sender sends a message and resumes its operation. Whereas the receiver may receive a valid message or a null.

Thus, the synchronous message passing achieves synchronization between the communicating processes. Which is an essential part of any interprocess communication.

So, this is all about interprocess communication. We have discussed the need for IPC and issues that occurred in IPC. And two models that the operating system can implement to achieve IPC.

Related Terms:

  1. Shared Memory System in IPC
  2. Intermediate Code Generation
  3. Bottom-Up Parsing in Compiler Design
  4. Data Privacy in Cloud Computing
  5. Data Warehouse Architecture

Reader Interactions

Leave a Reply Cancel reply

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

Primary Sidebar

Most Searched Terms

  • Directory Structure
  • Contiguous Memory Allocation
  • Addressing Mode and its Types
  • Pipelining
  • Vector Processing
  • Register Organization
  • Direct Memory Access (DMA)
  • Process Control Block (PCB)
  • Swapping in Operating System
  • Relational Data Model

Recent Additions

  • Wired Local Area Network
  • Multiple Access Control
  • Hardwired Control Unit
  • Producer Consumer Problem
  • Interprocess Communication (IPC)
  • Cloud Ecosystem
  • System Software
  • Data Link Layer Design Issues
  • Cloud Architecture
  • Linker and Loader in System Programming

Categories

  • Cloud Computing
  • Compiler Design
  • Computer Architecture
  • Computer Networks
  • Data Warehouse and Mining
  • DBMS
  • Object Oriented Technology
  • Operating System
  • Security
  • Software Engineering

Copyright © 2023 · Binary Terms · Contact Us · About Us · Privacy