Open In App

Methods in Inter process Communication

Last Updated : 11 Jul, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Inter Process communication (IPC) refers to the mechanisms and techniques used by operating systems to allow different processes to communicate with each other. This allows running programs concurrently in an Operating System.

The two fundamental models of Inter Process Communication are:

  • Shared Memory
  • Message Passing

Shared Memory

IPC through Shared Memory is a method where multiple processes are given access to the same region of memory. This shared memory allows the processes to communicate with each other by reading and writing data directly to that memory area.

Shared Memory in IPC can be visualized as Global variables in a program which are shared in the entire program but shared memory in IPC goes beyond global variables, allowing multiple processes to share data through a common memory space, whereas global variables are restricted to a single process.

To read more refer - IPC through Shared Memory

Message Passing

IPC through Message Passing is a method where processes communicate by sending and receiving messages to exchange data. In this method, one process sends a message, and the other process receives it, allowing them to share information. Message Passing can be achieved through different methods like Sockets, Message Queues or Pipes.

Sockets provide an endpoint for communication, allowing processes to send and receive messages over a network. In this method, one process (the server) opens a socket and listens for incoming connections, while the other process (the client) connects to the server and sends data. Sockets can use different communication protocols, such as TCP (Transmission Control Protocol) for reliable, connection-oriented communication or UDP (User Datagram Protocol) for faster, connectionless communication.

To read more refer - IPC using Message Queues

Different methods of Inter process Communication (IPC) are as follows:

  1. Pipes - A pipe is a unidirectional communication channel used for IPC between two related processes. One process writes to the pipe, and the other process reads from it.
    Types of Pipes are Anonymous Pipes and Named Pipes (FIFOs)
  2. Sockets - Sockets are used for network communication between processes running on different hosts. They provide a standard interface for communication, which can be used across different platforms and programming languages.
  3. Shared memory - In shared memory IPC, multiple processes are given access to a common memory space. Processes can read and write data to this memory, enabling fast communication between them.
  4. Semaphores - Semaphores are used for controlling access to shared resources. They are used to prevent multiple processes from accessing the same resource simultaneously, which can lead to data corruption.
  5. Message Queuing - This allows messages to be passed between processes using either a single queue or several message queue. This is managed by system kernel these messages are coordinated using an API.

Inter Process Communication across the System

Inter-Process Communication (IPC) across the system refers to the methods that allow processes to communicate and exchange data, even when they are running on different machines or in a distributed environment.

Using Remote Procedure calls

Remote Procedure Calls (RPC) allows a program to call a procedure (or function) on another machine in a network, as though it were a local call. It abstracts the details of communication and makes distributed systems easier to use. RPC is a technique used for distributed computing. It allows processes running on different hosts to call procedures on each other as if they were running on the same host.

Using Remote Method Invocation

Remote Method Invocation (RMI) is a Java-based technique used for Inter-Process Communication (IPC) across systems, specifically for calling methods on objects located on remote machines. It allows a program running on one computer (the client) to execute a method on an object residing on another computer (the server), as if it were a local method call.

Each method of IPC has its own advantages and disadvantages, and the choice of which method to use depends on the specific requirements of the application. For example, if high-speed communication is required between processes running on the same host, shared memory may be the best choice. On the other hand, if communication is required between processes running on different hosts, sockets or RPC may be more appropriate.

Conclusion

Inter-Process Communication (IPC) enables processes to share data and work together through methods like Shared Memory, Message Passing, Pipes, Sockets, Semaphores, Remote Procedure Calls (RPC) and Remote Method Invocation (RMI). Each method has unique strengths suited for different scenarios, such as local or distributed systems. This page provides an overview of IPC methods, and you can explore detailed explanations and uses of each method from here.


Article Tags :

Similar Reads