Open In App

Inter Process Communication (IPC)

Last Updated : 29 Aug, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Processes need to communicate with each other in many situations. Inter-Process Communication or IPC is a mechanism that allows processes to communicate.

  • It helps processes synchronize their activities, share information and avoid conflicts while accessing shared resources.
  • There are two method of IPC, shared memory and message passing. An operating system can implement both methods of communication.

Shared Memory

Communication between processes using shared memory requires processes to share some variable and it completely depends on how the programmer will implement it. Processes can use shared memory for extracting information as a record from another process as well as for delivering any specific information to other processes.

Shared_Memory
Shared Memory
  • In the above shared memory model, a common memory space is allocated by the kernel.
  • Process A writes data into the shared memory region (Step 1).
  • Process B can then directly read this data from the same shared memory region (Step 2).
  • Since both processes access the same memory segment, this method is fast but requires synchronization mechanisms (like semaphores) to avoid conflicts when multiple processes read/write simultaneously.

Message Passing

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.
Message_Passing_
Message Passing
  • In the above message passing model, processes exchange information by sending and receiving messages through the kernel.
  • Process A sends a message to the kernel (Step 1).
  • The kernel then delivers the message to Process B (Step 2).
  • Here, processes do not share memory directly. Instead, communication happens via system calls (send(), recv(), or similar).
  • This method is simpler and safer than shared memory because there’s no risk of overwriting shared data, but it incurs more overhead due to kernel involvement.

Please refer Methods in Inter process Communication for more details.


Explore