Mousumi Ghosh 10211422007 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Technical Report

on the
Inter Process Communication (IPC) in
Distributed Computing System

Kalyani Government Engineering


College

by

Mousumi Ghosh

Roll No: 10211422007


Papername: Distributed Computing System (PGIT 203)
Stream: Master of Technology in I T
1st year, 2nd Semester

12th March, 2023


Contents

1. Abstract................................................................................................1

2. Introduction...........................................................................................1

3. Example of IPC.....................................................................................2

4. Types of IPC...........................................................................................3

5. Synchronization in IPC.........................................................................5

6. Charterisctics of IPC.............................................................................6

7. Advantages of IPC..................................................................................7

8. Disadvantages of IPC.............................................................................8

9. Application of IPC..................................................................................8

10. Conclusion...............................................................................................8

11. References.................................................................................. ............8


Inter Process Communication (IPC) in
Distributed System

Mousumi Ghosh
Department of Information Technology, Kalyani Government Engineering College

Abstract:

IPC stands for Interprocess Communication. It is a technology that, as its name implies, permits
communication between many threads running in a single or numerous processes. It permits
data flow across numerous threads of a single process or system, or between several processes or
systems connected by a network.

A single or several processes can utilize this technology to share data between threads since it can
handle multiple requests at once. Operating systems employ IPC to distribute a lot of data. It can
also have an impact on performance and is not supported by a single-process operating system like
DOS. The requests are coordinated and carried out concurrently in this technique. As a result, all
the processes are efficient, interact with one another without interfering with one another, and
work together. As a result, it gives programmers the ability to coordinate the actions of many
applications that are running in the background of an operating system. A software may deal with
several user requests at once using this technology.

1. Introduction:
Inter-process communication (IPC) is a critical aspect of distributed computing systems that
enable processes running on different machines to communicate and coordinate with each other. A
distributed computing system consists of multiple processes running on different machines, which
need to work together to achieve a common goal. IPC provides a mechanism for these processes
to exchange data, synchronize their activities, and coordinate their actions. This technical report
provides an overview of inter-process communication in distributed computing systems. It
discusses the different IPC mechanisms used in distributed computing systems, including Remote
Procedure Call (RPC), Message Passing, Shared Memory, and Socket Programming. It also
highlights the advantages and disadvantages of each mechanism and provides examples of their
use in real-world distributed computing systems.

Interprocess Communication
Process P1 Process P2

Page | 1
2. Inter-process Communication Examples:

• Posix uses the shared memory technique.


• Windows XP uses message passing technique.
• Mach uses the message passing technique.
- Pipes
- Server

Consider the following example:


 Using network protocols, N applications can connect to the X server.
 To handle requests, servers like Apache generate child processes.
 In IPC pipes are a form of inter process communication: grep foo file | sort

Device Device

Server Server

Figure: N number of devices connected to X server in IPC

Page | 2
3. Types of Inter Process Communication:

Asynchronous or synchronous communication between the sending and receiving processes is


possible. Therefore, synchronous and asynchronous communication services are provided by
the IPC feature. Here is a discussion of the distinction between synchronous and asynchronous
inter-process communication.

3.1 Synchronous IPC


The sending and receiving of messages in this sort of communication happen simultaneously with
each message. So, in this instance, sending and receiving are both blocking actions. The
transmitting process is blocked when a send is sent to it until a corresponding receive is sent. In a
similar manner, when a receive is sent via a process, it is blocked until a message is received.

3.2 Asynchronous IPC


The send operation is non-blocking in this sort of communication because the message's parallel
transmission will continue throughout the sending process and the process of sending will be
allowed to continue once the message has been copied towards a local buffer.
There are blocking and non-blocking variations of the receive operation. Once a receive operation
is issued, the receiving process in the non-blocking variation continues through its programme,
allowing a buffer to be filled in the background, but it needs to be informed independently.

Although non-blocking communication is very effective, it adds complexity to the synchronization


and data loss prevention processes. Because of these factors, most current systems do not provide
the non-blocking form of receiver.

4. Approaches to Inter process Communication

There are numerous ways to communicate between processes, including pipes, sockets, files,
signals, shared memory message queues, and message passing. Because the functioning of IPC
mainly depends on a few crucial ways or approaches, which are mentioned below, the following
forms of inter-process communication need to be taken into consideration in order to comprehend
all these concepts in more detail.

4.1 Pipes

One sort of unidirectional data route that is frequently used for communication between two
processes is a pipe. Due to the half-duplex nature of this approach, communication between the
primary and secondary processes is possible. However one more pipe is required in order to get a
full-duplex. A two-way data channel will be created
between two processes by two pipes. All POSIX systems
and the Windows OS mostly use pipes.

Page | 3
4.2 Socket

This serves as a network endpoint for sending and receiving data. This holds true for data sent
between processes on the same computer or, alternatively, between other machines connected to
the same network. The majority of operating systems employ sockets for IPC, or interprocess
communication.

Network

Socket in IPC
Process 1 Process 2
4.3 File

A file is a record of data that may be downloaded at any time from a file server or kept on a disc. A
file can be accessed by as many processes as required. To store data, all operating systems use
files.

4.4 Signal
The signal is very useful in IPC in a restricted way. They are system messages transmitted from
one process to another. Usually, signals are not utilized to transfer data however they are used for
remote commands in between different processes.

4.5 Message Queues

A message queue is a list of linked messages that is kept in the kernel. It is easily identifiable using
a message queue identifier. As a result, this method enables full-duplex communication between
one otherwise multiple processes.

Process A Process A

Message Queue
4.6 Shared Memory
This memory is the one that multiple programmes can access at once. As a result, communication
between the processes is straightforward. IPC model with shared memory is shown in the diagram
below. Both the processes, such as A and B, will create a shared memory area via which data can
be transferred.

The System forbids processes by default from accessing other processes' memory. A system call
would be used by the processes to designate a memory as shared memory. In order to utilise the
shared memory of other processes, the process should also synchronise using one of the several
synchronisation strategies available.
Page | 4
4.7 Message Passing
It is a method of synchronisation and communication. This allows the process to communicate with
one another without the use of shared variables. As a result, processes in this mode communicate
via messages with assistance from the underlying OS. The message passing diagram that follows
shows how two processes, such as A and B, are interacting with one another.

The OS kernel receives a message similar to "M" from A Process in this instance. Process B is then
used to read this message after that. Between the two processes, a communication link is necessary
for message exchange to be successful. These linkages can be created using a variety of techniques.

Process A
Process A M
Shared Memory

Process B Process B M

Kernel Kernel M

Figure: Shared Memory and Message passing

5. Synchronization in Inter process Communication


Synchronization is a crucial component of inter-process communication (IPC), which is offered by
either inter process control mechanism or, in the absence of that, by the communicating processes.
The following are some synchronization methods that are accessible.

5.1 Semaphore
One class of integer variable called a semaphore regulates the connection to a shared resource
using a number of procedures. The critical section problem is solved using a semaphore variable,
which is also used to achieve process synchronization in a multiprocessing environment.

Hence, is employed to protect any resources, such as global shared memory, that must be accessed
& altered by numerous processes at once. The resources are protected or locked by semaphore.
When a process needs to authorize a resource, it must first obtain the semaphore's approval.
Semaphore therefore grants permission to access a resource when it is free, failing which the
process must wait. There are two types of semaphores: binary and counting. A mutex lock is a
binary semaphore.

Page | 5
5.2 Mutual Exclusion

In this exclusion needs simply one process thread that can go into the critical segment at a time.
Just one process thread that can enter the crucial region at a time is required for this exclusion. So,
this is excellent for synchronisation and prevents race circumstances.

This sort of attribute for process synchronisation specifies that no processes may be running at any
given time within the crucial area. Any synchronisation process approach should adhere to the
mutual exclusion principle; else, race conditions cannot be eliminated.

A race condition is an undesirable situation that arises when a system or device tries to conduct
several actions concurrently when, given the nature of the system or device, the operations should
be carried out in the proper order.

5.3 Barrier

Until all processes have passed the barrier, separate processes are not allowed to continue.
Different parallel languages and societal customs may act as barriers.

When a process encounters a barrier, it should halt there and cannot be allowed to continue until all
of the group's processes have reached the barrier. All processes can restart execution and continue
from the barrier once the last process reaches it.

5.4 Spinlock

One sort of lock called a spinlock implements inter-thread locking via machine-dependent
assembly instructions. After a process makes an attempt to obtain this lock, it will repeatedly check
to see if it has succeeded. Because the process is active but not carrying out any functional
operations, it is known as busy waiting. Due to the fact that they function better when locked for a
brief length of time, these are primarily employed as a substitute for mutual exclusion locks.

6. Characteristics of IPC
The characteristics of inter-process communication within a distributed system are discussed
below.

i. Synchronous System Calls:


The blocking system is used by the sender and receiver in synchronous system calls to transmit
data, allowing the sender to wait until the recipient responds and the receiver to wait until the
message is received.

Page | 6
ii. Asynchronous System Calls: With asynchronous system calls, the sender and the receiver
both use the non-blocking system to communicate the information, which means the sender is
not waiting for the receiver's response.

iii. Destination of Message: In a computer, a local port is a message destination that is specified
using an integer. A port has numerous senders but only one receiver. Several ports may be
used by programmes or processes to receive messages. Any process can determine the port
number to send a message to.

iv. Reliability: Integrity and validity are terms that define reliability.

v. Integrity: The messages must reach the destination without duplicate or corruption.

vi. Validity: A communication is considered valid if it is delivered without being lost.

vii. Ordering: It is a technique for sending messages to the recipient in a predetermined


sequence. Messages must be sent in the order of the sender, or the order in which they were
sent through the sender, for some applications.

7. Advantages of IPC

 Data exchange without interruption is made possible through inter-process communication,


which enables one application to control another.
 By the use of semaphores, segments, and other techniques, this communication enables the
sharing of data and memory between various processes.
 Effective message conveyance between processes is made possible by interprocess
communication.
 Sending a message almost guarantees that synchronisation and named pipe blocking
problems won't arise.
 Using some method, we can access the emergency notice in advance.
 It is possible for multiple programmes to share data simultaneously.
 The division of work into smaller tasks and the use of particular types of processors are
both options. Data exchange can then take place using IPC.
 The fact that programmes are separated into different code chunks that can function
independently makes it easy to maintain and troubleshoot them.
 The programmer can work on multiple projects concurrently, including editing, listening to
music, compiling, etc.

Page | 7
8. Disadvantages of IPC

 Every data block includes the longest permitted length, much like the pipe.
 There is also an upper restriction on the total length of system data for all blocks included in
the queue.
 Check that no processes or software applications using the shared memory paradigm are
simultaneously writing to the same memory location.
 A shared memory paradigm may lead to problems with synchronisation and memory
protection that need to be resolved.
 It takes longer to execute than simple function calls.
 Certain synchronisation and memory protection issues may arise and need to be fixed.
 It prevents the applications from writing to the same region of memory.

9. Applications of IPC

 The fundamental purpose of inter-process communication is to transfer data between


various threads running in one or more programmes or processes.
 One form of mechanism that enables software to converse with one another and
synchronise their actions is interprocess communication.
 Because microkernels reduce several functionalities that the kernel provides, IPC is crucial
in the design of microkernels and nano-kernels. The next step is to communicate with
servers via IPC in order to achieve these features.
 The key to designing an application as a collection of cooperating processes, where each
process takes care of a clearly defined portion of the whole, is inter process communication.

10. Conclusion:

An overview of inter-process communication, which enables data interchange between


programmes or processes, is what this article is all about. By offering a set of programming
interfaces, this sort of communication aids a programmer in organizing the actions between
multiple processes. IPC enables data communication by allowing several processes to use various
techniques, such as segments and semaphores, to exchange memory and data.

11. Reference:
 Web site:
 https://www.geeksforgeeks.org/
 https://www.tutorialspoint.com/
 https://www.elprocus.com/inter-process-communication

 Book: Interprocess Communication: An Overview

- By Sukumar Ghosh
Page | 8
PLAGIARISM SCAN REPORT

Date 2023-03-11

0% 100% Words 893


Plagiarised Unique

Characters 6244

Content Checked For Plagiarism

Inter Process Communication (IPC) in Distributed System

Mousumi Ghosh

Department of Information Technology, Kalyani Government Engineering College

Abstract:
IPC stands for Interprocess Communication. It is a technology that, as its name implies, permits communication between
many threads running in a single or numerous processes. It permits data flow across numerous threads of a single process
or system, or between several processes or systems connected by a network.
A single or several processes can utilize this technology to share data between threads since it can handle multiple
requests at once. Operating systems employ IPC to distribute a lot of data. It can also have an impact on performance and
is not supported by a single-process operating system like DOS. The requests are coordinated and carried out concurrently
in this technique. As a result, all the processes are efficient, interact with one another without interfering with one another,
and work together. As a result, it gives programmers the ability to coordinate the actions of many applications that are
running in the background of an operating system. A software may deal with several user requests at once using this
technology.

1. Introduction:
Inter-process communication (IPC) is a critical aspect of distributed computing systems that enable processes running on
different machines to communicate and coordinate with each other. A distributed computing system consists of multiple
processes running on different machines, which need to work together to achieve a common goal. IPC provides a
mechanism for these processes to exchange data, synchronize their activities, and coordinate their actions. This technical
report provides an overview of inter-process communication in distributed computing systems. It discusses the different
IPC mechanisms used in distributed computing systems, including Remote Procedure Call (RPC), Message Passing, Shared
Memory, and Socket Programming. It also highlights the advantages and disadvantages of each mechanism and provides
examples of their use in real-world distributed computing systems.

2. Inter-process Communication Examples:

• Posix uses the shared memory technique.


• Windows XP uses message passing technique.
Page | 1
• Mach uses the message passing technique.

Page1of3
- Pipes
- Server

Consider the following example:


Using network protocols, N applications can connect to the X server.
To handle requests, servers like Apache generate child processes.
In IPC pipes are a form of inter process communication: grep foo file | sort

3. Types of Inter Process Communication:

Asynchronous or synchronous communication between the sending and receiving processes is possible. Therefore,
synchronous and asynchronous communication services are provided by the IPC feature. Here is a discussion of the
distinction between synchronous and asynchronous inter-process communication.

3.1 Synchronous IPC


The sending and receiving of messages in this sort of communication happen simultaneously with each message. So, in
this instance, sending and receiving are both blocking actions. The transmitting process is blocked when a send is sent to it
until a corresponding receive is sent. In a similar manner, when a receive is sent via a process, it is blocked until a message
is received.

3.2 Asynchronous IPC


The send operation is non-blocking in this sort of communication because the message's parallel transmission will
continue throughout the sending process and the process of sending will be allowed. Once a receive operation is issued,
the receiving process in the non-blocking variation continues through its programme, allowing a buffer to be filled in the
background, but it needs to be informed independently.

Although non-blocking communication is very effective, it adds complexity to the synchronization and data loss prevention
processes. Because of these factors, most current systems do not provide the non-blocking form of receiver.

4. Approaches to Inter process Communication

There are numerous ways to communicate between processes, including pipes, sockets, files, signals, shared memory
message queues, and message passing. Because the functioning of IPC mainly depends on a few crucial ways or
approaches, which are mentioned below, the following forms of inter-process communication need to be taken into
consideration in order to comprehend all these concepts in more detail.

4.1 Pipes

One sort of unidirectional data route that is frequently used for communication between two processes is a pipe. Due to
the half-duplex nature of this approach, communication between the primary and secondary processes is possible.
However one more pipe is required in order to get a full-duplex. A two-way data channel will be created between two
processes by two pipes. All POSIX systems and the Windows OS mostly use pipes.

4.2 Socket

This serves as a network endpoint for sending and receiving data. This holds true for data sent between processes on the
same computer or, alternatively, between other machines connected to the same network. The majority of operating
systems employ sockets for IPC, or interprocess communication.
Page | 2

Page2of3
4.3 File

A file is a record of data that may be downloaded at any time from a file server or kept on a disc. A file can be accessed by
as many processes as required. To store data, all operating systems use files.

4.4 Signal

The signal has a limited amount of utility in IPC. These are transmissions of system messages between processes. Signals
are typically employed for remote commands between various processes rather than for data transfer.

4.5 Message Queues

A message queue is a list of linked messages that is kept in the kernel. It is easily identifiable using a message queue
identifier. As a result, this method enables full-duplex communication between one otherwise multiple processes.

Matched Source

No plagiarism found

should also synchronise using one of the several synchronisation strategies available.
4.7 Message Passing
It is a method of synchronisation and communication. This allows the process to communicate with one another without
the use of shared variables. As a result, processes in this mode communicate via messages with assistance from the
underlying OS. The message passing diagram that follows shows how two processes, such as A and B, are interacting with
one another.
The OS kernel receives a message similar to "M" from A Process in this instance. Process B is then used to read this
message after that. Between the two processes, a communication link is necessary for message exchange to be successful.
These linkages can be created using a variety of techniques.

Page | 1
5. Synchronization in Inter process Communication

Page3of3
Page1of3
PLAGIARISM SCAN REPORT

Date 2023-03-11

0% 100% Words 971


Plagiarised Unique

Characters 6702

Content Checked For Plagiarism

4.6 Shared Memory

This memory is the one that multiple programmes can access at once. As a result, communication between the processes is
straightforward. IPC model with shared memory is shown in the diagram below. Both the processes, such as A and B, will
create a shared memory area via which data can be transferred.

The System forbids processes by default from accessing other processes' memory. A system call would be used by the
processes to designate a memory as shared memory. In order to utilise the shared memory of other processes, the process

Page | 2
Synchronization is a crucial component of inter-process communication (IPC), which is offered by either inter process
control mechanism or, in the absence of that, by the communicating processes. The following are some synchronization
methods that are accessible.

5.1 Semaphore
One class of integer variable called a semaphore regulates the connection to a shared resource using a number of
procedures. The critical section problem is solved using a semaphore variable, which is also used to achieve process
synchronization in a multiprocessing environment.

Hence, is employed to protect any resources, such as global shared memory, that must be accessed & altered by
numerous processes at once. The resources are protected or locked by semaphore. When a process needs to authorize a
resource, it must first obtain the semaphore's approval. Semaphore therefore grants permission to access a resource when
it is free, failing which the process must wait.

5.2 Mutual Exclusion

In this exclusion needs simply one process thread that can go into the critical segment at a time. Just one process thread
that can enter the crucial region at a time is required for this exclusion. So, this is excellent for synchronisation and
prevents race circumstances.

This sort of attribute for process synchronisation specifies that no processes may be running at any given time within the
crucial area. Any synchronisation process approach should adhere to the mutual exclusion principle; else, race conditions
cannot be eliminated.

A race condition is an undesirable situation that arises when a system or device tries to conduct several actions
concurrently when, given the nature of the system or device, the operations should be carried out in the proper order.

6. Characteristics of IPC

i. Synchronous System Calls:


The blocking system is used by the sender and receiver in synchronous system calls to transmit data, allowing the sender
to wait until the recipient responds and the receiver to wait until the message is received.

ii. Asynchronous System Calls: With asynchronous system calls, the sender and the receiver both use the non-blocking
system to communicate the information, which means the sender is not waiting for the receiver's response.

iii. Destination of Message: In a computer, a local port is a message destination that is specified using an integer. A port
has numerous senders but only one receiver. Several ports may be used by programmes or processes to receive messages.
Any process can determine the port number to send a message to.

7. Advantages of IPC

• Data exchange without interruption is made possible through inter-process communication, which enables one Page | 2
application to control another.

Page2of3
• By the use of semaphores, segments, and other techniques, this communication enables the sharing of data and
memory between various processes.
• Effective message conveyance between processes is made possible by interprocess communication.
• Sending a message almost guarantees that synchronisation and named pipe blocking problems won't arise.
• Using some method, we can access the emergency notice in advance.
• It is possible for multiple programmes to share data simultaneously.

8. Disadvantages of IPC

• Every data block includes the longest permitted length, much like pipe.
• There is also an upper restriction on total length of system data for all blocks included in the queue.
• Check that no processes or software applications using the shared memory paradigm are simultaneously writing to
same memory location.
• A shared memory paradigm may lead to problems with synchronisation and memory protection that need to be
resolved.

9. Applications of IPC

• The fundamental purpose of inter-process communication is to transfer data between various threads running in one
or more programmes or processes.
• One form of mechanism that enables software to converse with one another and synchronise their actions is
interprocess communication.
• Because microkernels reduce several functionalities that the kernel provides, IPC is crucial in the design of
microkernels and nano-kernels. The next step is to communicate with servers via IPC in order to achieve these features.
• The key designing an application as a collection of cooperating processes, where each process takes care of a clearly
defined portion of the whole, is inter process communication.

10. Conclusion:

An overview of inter-process communication, which enables data interchange between programmes or processes, is what
this article is all about. By offering a set of programming interfaces, this sort of communication aids a programmer in
organizing the actions between multiple processes. IPC enables data communication by allowing several processes to use
various techniques, such as segments and semaphores, to exchange memory and data.

Matched Source

No plagiarism found

Page | 3

Page3of3

You might also like