Approaches To Interprocess Communication
Approaches To Interprocess Communication
1. Pipes
2. Shared Memory
3. Message Queue
4. Direct Communication
5. Indirect communication
6. Message Passing
7. FIFO
Pipe:-
The pipe is a type of data channel that is unidirectional in nature. It means that the data in this
type of data channel can be moved in only a single direction at a time. Still, one can use two-
channel of this type, so that he can able to send and receive data in two processes. Typically,
it uses the standard methods for input and output. These pipes are used in all types of POSIX
systems and in different versions of window operating systems as well.
Shared Memory:-
It can be referred to as a type of memory that can be used or accessed by multiple processes
simultaneously. It is primarily used so that the processes can communicate with each other.
Therefore the shared memory is used by almost all POSIX and Windows operating systems
as well.
Message Queue:-
In general, several different messages are allowed to read and write the data to the message
queue. In the message queue, the messages are stored or stay in the queue unless their
recipients retrieve them. In short, we can also say that the message queue is very helpful in
inter-process communication and used by all operating systems.To understand the concept of
Message queue and Shared memory in more detail, let's take a look at its diagram given
below:
Message Passing:-
It is a type of mechanism that allows processes to synchronize and communicate with each
other. However, by using the message passing, the processes can communicate with each
other without restoring the hared variables.Usually, the inter-process communication
mechanism provides two operations that are as follows:
send (message)
o received (message)
Indirect Communication
FIFO:-
o File:-
A file is a type of data record or a document stored on the disk and can be acquired
on demand by the file server. Another most important thing is that several processes
can access that file as required or needed.
o Signal:-
As its name implies, they are a type of signal used in inter process communication in
a minimal way. Typically, they are the massages of systems that are sent by one
process to another. Therefore, they are not used for sending data but for remote
commands between multiple processes.
Usually, they are not used to send the data but to remote commands in between
several processes.
Why we need interprocess communication?
There are numerous reasons to use inter-process communication for sharing the
data. Here are some of the most important reasons that are given below:
o
o Pipes
o These are interprocess communication methods that contain two end points.
Data is entered from one end of the pipe by a process and consumed from
the other end by the other process.
o The two different types of pipes are ordinary pipes and named pipes. Ordinary
pipes only allow one way communication. For two way communication, two
pipes are required. Ordinary pipes have a parent child relationship between
the processes as the pipes can only be accessed by processes that created
or inherited them.
o Named pipes are more powerful than ordinary pipes and allow two way
communication. These pipes exist even after the processes using them have
terminated. They need to be explicitly deleted when not required anymore.
o A diagram that demonstrates pipes are given as follows −
o