KEMBAR78
Interprocessor Communication and Synchronization 2 | PDF | Software Engineering | Computing
0% found this document useful (0 votes)
66 views3 pages

Interprocessor Communication and Synchronization 2

Interprocessor communication is a mechanism that enables processes in a multiprocessor system to exchange information and synchronize their actions. Key synchronization methods include mutual exclusion, semaphores, barriers, and spinlocks, while communication approaches include pipes, shared memory, message queues, and message passing. The need for inter-process communication arises from its benefits in modularity, computational efficiency, and facilitating communication within the operating system.

Uploaded by

kewir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
66 views3 pages

Interprocessor Communication and Synchronization 2

Interprocessor communication is a mechanism that enables processes in a multiprocessor system to exchange information and synchronize their actions. Key synchronization methods include mutual exclusion, semaphores, barriers, and spinlocks, while communication approaches include pipes, shared memory, message queues, and message passing. The need for inter-process communication arises from its benefits in modularity, computational efficiency, and facilitating communication within the operating system.

Uploaded by

kewir
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Interprocessor Communication

and Synchronization
Introduction
In general, Interprocess Communication is a mechanism provided by the Operating
System (or OS). The various processors in a multiprocessor system should be
provided with a facility for communicating with each other. The working of this
mechanism is to provide communications between several processes.
In short, intercommunication allows a process to let another process know that some
event has occurred or data is to be transferred from one process to another.

Interprocessor communication is used for interchanging useful information among


various regions in one or more processes (or programs). This communication could
involve letting another process know that some event has occurred or the
transferring of data from one process to another.

Synchronization in Interprocessor Communication


Synchronization is an essential part of interprocess communication. It refers to a
case where the data used to communicate between processors is control
information. It is either given by the interprocess control mechanism or handled by
the communicating processes.
It is required to maintain the correct sequence of processes and to make sure equal
access to shared writable data.
Multiprocessor systems have various mechanisms for the synchronization of
resources. Below are some methods to provide synchronization are as follows −
1. Mutual Exclusion
2. Semaphore
3. Barrier
4. Spinlock
Mutual Exclusion
Mutual Exclusion requires that only a single process thread can enter the critical
section one at a time. This also helps synchronize and prevents the race condition
by creating a stable state.
Semaphore
Semaphore is a type of variable that generally controls the access to the shared
resources by several processes. Further, Semaphore is divided into two types as
follows:
Binary Semaphore
A binary semaphore is limited to zero or one. It could be used to control access to
one resource. In particular, it can be used to force the same release of an important
category in the user code.
Counting Semaphore
Counting semaphore may take any integer value. It could be used to control access
to resources having many instances.
Barrier
A barrier ( as evident by its name) does not allow an individual process to proceed
unless all the processes do not reach it. Many parallel languages use it, and
collective routines impose barriers.
Spinlock
As evident by its name, a spinlock is a type of lock that prevents processes from
operating any function unless it is available. The processes which are trying to
acquire the spinlock wait in a loop while checking if the lock is available or not. This
is also known as busy waiting because the process is not doing any helpful operation
even though it is active.
Approaches of Interprocess Communication
Following are the approaches to implement Inter-process Communication:-
1. Pipes
2. Shared Memory
3. Message Queue
4. Direct Communication
5. Indirect Communication
6. Message Passing
7. FIFO

Pipe
Pipe is a unidirectional data channel in which data can be moved in only one
direction at a time. For standard input and output methods, we can use two such
pipes to create two-way channels to send and receive the data in two processes, i.e,
in input and output. These are used in all POSIX(Portable Operating System
Interface) systems and various versions of Windows OS.

Shared Memory
Shared memory is a type of memory that can be used or accessed by multiple
processes simultaneously. This is done for a reason as processes can communicate
with each other. That is why almost all POSIX systems and Windows operating
systems use shared memory.

Message Queue
Multiple processes can read-write the data to the message queue even without
connecting. Messages are stored in the queue till their recipient retrieves them back.
Message queues are helpful for interprocess communication and are also used by
most operating systems.

Message Passing
It is a mechanism that processes synchronization and communicates with each
other. But, using this mechanism, the processes can communicate without the
shared variables being restored.
Generally, the inter-process communication mechanism provides two operations that
are as follows:
 send (message)
 received (message)
Direct Communication
Generally, a link is established between two communication processes in this type of
communication. However, only one link can exist in every pair of communicating
processes.
Indirect Communication
When processes share a common mailbox then only indirect communication can be
established. Here, each pair of these processes shares multiple links of
communication. The nature of these shared links could be unidirectional or bi-
directional.
FIFO
It is general communication between two unrelated processes. It is also considered
full-duplex, which means that one process can communicate with another and vice
versa.
Some other different processes
The various other processes are as follows:-
Socket
It is an endpoint for receiving or sending the data in a network. It is suitable for the
data sent between processes on the same computer or different computers on the
same network. That is why several types of operating systems use it.
File
A file is a data record or a document stored on the disk. It can be acquired on
demand by the file server. As per requirement, the data can be accessed.
Signal
As its name shows, they are a signal used in inter-process communication minimally.
Typically, they are the messages of systems that are sent by one process to another.
Therefore, they are not used for transmitting data but in remote commands among
multiple processes.
Need for Inter-process Communication
There are various reasons to use inter-process communication for sharing the data.
Here are some of the most important reasons that show the importance of inter-
process communication:
 It helps in speeding up modularity
 It is computational.
 It gives the privilege of separation as well as connection.
 Convenient
 It allows the operating system to communicate and synchronize its
actions

You might also like