Inter Process Communication
Inter Process Communication
Inter Process Communication
Inter process communication in OS is way by which multiple processes can communicate with
each other. Shared memory in OS, message queues, FIFO etc are some of the ways to achieve
ipc in os.
A system can have two types of processes i.e. independent or cooperating. Cooperating processes
affect each other and may share data and information among themselves.
Sharing data
Coordinating activities
Managing resources
Achieving modularity
Pipes are a simple form of shared memory that allows two processes to communicate
with each other.
It is a half duplex method (or one way communication) used for IPC between two related
processes .
One process writes data to the pipe, and the other process reads data from the pipe.
It is like a scenario like filling water with a tap into a bucket. The filling process is
writing into the pipe and the reading process is retrieving from the pipe.
Pipes can be either named or anonymous, depending on whether they have a unique name
or not.
Named pipes are a type of pipe that has a unique name, and can be accessed by multiple
processes. Named pipes can be used for communication between processes running on
the same host or between processes running on different hosts over a network.
Anonymous pipes, on the other hand, are pipes that are created for communication
between a parent process and its child process. Anonymous pipes are typically used for
one-way communication between processes, as they do not have a unique name and can
only be accessed by the processes that created them.
Shared Memory
Message Passing
Message Queues
We have linked list to store messages in a kernel of OS and a message queue is identified using
"message queue identifier".
Direct Communication
Indirect Communication
FIFO
FIFO (First In First Out) is a type of message queue that guarantees that messages are
delivered in the order they were sent.
It involves the use of a FIFO buffer, which acts as a queue for exchanging data between
processes.
Used to communicate between two processes that are not related.
In the FIFO method, one process writes data to the FIFO buffer, and another process
reads the data from the buffer in the order in which it was written.
Full-duplex method - Process P1 is able to communicate with Process P2, and vice versa.
The main advantage of the FIFO method is that it provides a simple way for processes to
communicate, as data is exchanged sequentially, and there is no need for processes to
coordinate their access to the FIFO buffer.
However, the FIFO method can also introduce limitations, as it may result in slow
performance if the buffer becomes full and data must be written to the disk, or if the
buffer becomes empty and data must be read from the disk.
Sharing data: IPC allows processes to share data with each other. This is essential for
many tasks, such as sharing files, databases, and other resources.
Coordinating activities: IPC allows processes to coordinate their activities. This is
essential for tasks such as distributed computing, where multiple processes are working
together to solve a problem.
Managing resources: IPC allows processes to manage resources such as memory,
devices, and files. This is essential for ensuring that resources are used efficiently.
Achieving modularity: IPC allows processes to be developed and maintained
independently of each other. This makes it easier to develop and maintain large and
complex software systems.
Flexibility: IPC allows processes to run on different hosts or nodes in a network,
providing greater flexibility and scalability in large and complex systems.