Inter process communication
What is inter process communication?
Inter process communication (IPC) is used for exchanging data between multiple threads in one or more programs.
It is a set of programming interfaces that allows a programmer to coordinate activities among multiple program processes that can run simultaneously in an operating system.
Approaches for Inter process communication:
Important methods of inter process communication are:
- Pipes
Pipes provide a one-way flow of data between two related processes. It is a half-duplex method, therefore the first process communicates with the second process. To achieve a full-duplex two pipes are needed.
- Message passing
Message passing helps the process communicate with each other without falling back onto shared variables.
IPC mechanism has the following two operations:
- Send message
- Receive message
- Message queues
Message queues offer communication between single and multiple processors with full-duplex capacity. It is a linked list of messages in the kernel.
- FIFO
FIFO is a full-duplex method, which means the first process can communicate with the second process, and vice versa.
- Direct communication
In a direct communication method, a link is established between a pair of communicating processes.
- Indirect communication
In indirect communication a link can communicate with multiple processes, the link may be bi-directional or multidirectional. It establishes only when each pair of processes share several communication links.
- Shared memory
Shared memory is a memory that can be simultaneously accessed by multiple programs with the intent to provide communication among them or avoid unnecessary copies.
Objectives of IPC:
- IPC helps to increase the speed of modularity.
- It is convenient.
- It helps the OS to communicate and synchronize their actions.
- Computational.
Reference:
Inter process communications of operating system.