What are the advantages of Inter process communication

What is Inter Process Communication : Working & Its ApplicationsA System may be a Digital processor, Computer system or any Corporate system performs its task through a process

What are the advantages of Inter process communication

What is Inter Process Communication : Working & Its Applications

A System may be a Digital processor, Computer system or any Corporate system performs its task through a process. A system may run through a single process or several process. When several processes perform at the same time, then they frequently need to communicate through each other for different reasons.  For a process to communicate with each other it require a set of rules which is called as a protocol. A process in a Microprocessor or a microcontroller is an active entity that includes several extra components apart from the program source code. This entity includes a process stack that stores the temporary data like local variables, function parameters, etc. There are two types of processes within a computer system, they are independent and cooperating. Independent processes do not share any with other processes whereas cooperating process shares data with other processes which need an Inter process communication or IPC.

What is Inter-Process Communication in OS?

Inter-process communication: A mechanism which is used to provide communications among several processes is known as inter-process communication or IPC and it is provided by the OS or operating system.

Inter Process Communication

Inter Process Communication

This type of communication is very helpful in data exchanging among several threads in single or multiple programs or processes which run on single or several computers connected through a network.
IPC is an interface with a set of programs that allows a programmer to coordinate activities in between various program processes in an operating system. So, this allows a particular program to handle several user requests simultaneously.

Ways of Inter-Process Communication

The communication between the sending & receiving processes may be either synchronous otherwise asynchronous. So, the feature of IPC provides synchronous and asynchronous communication services. The difference between synchronous and asynchronous inter-process communication is discussed below.

Synchronous IPC

In this type of communication, the processes of sending & receiving messages are synchronized with each message. So in this case, both the send & receive are blocking operations. Once a send is issued to the sending process then it is blocked until the equivalent receive is issued. Similarly, when a receive is issued through a process, then it blocked until a message appears.

Asynchronous IPC

In this type of communication, the send operation is non-blocking because the process of sending will be allowed to continue once the message has been copied towards a local buffer & the transmission of the message will continue in parallel throughout the sending process.

The receive operation includes blocking & non-blocking variants. The receiving process within the non-blocking variant continues through its program once a receive operation is issued, which offers a buffer to be packed within the background, however, it should get notification separately.

Non-blocking communication is very efficient however, it mainly involves additional complexity in maintaining synchronization and also preventing loss of data. Due to these reasons, present systems generally do not offer the non-blocking type of receiver.

Inter-Process Communication Types & Working

There are different modes of inter-process communication like pipes, socket, file, signal, shared memory message queue & message passing. To understand all these concepts in more detail, the following types of inter-process communication need to consider because the working of IPC mainly depends on a few important methods or approaches which are discussed below.

Pipes

A Pipe is one type of data channel, extensively used for communication in between two processes is unidirectional. This is a half-duplex technique, so the primary process communicates with the secondary process. But, to attain a full-duplex, one more pipe is needed. Two pipes will create a data channel in two-way in between two processes. Pipes are mainly used in Windows OS & all POSIX systems.

Pipes

Pipes

Socket

This is the endpoint to transmit or receive data within a network. This is true for data transmitted between processes on a similar computer otherwise between various computers on a similar network. Sockets are used by most of the operating systems for IPC or interprocess communication.

Socket in IPC

Socket in IPC

File

A file is a data record that is stored on a disk or obtained on demand through a file server. Several processes can access a file as necessary. All operating systems utilize files for storing data.

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.

Message Queues

A linked list of messages is known as a message queue that is stored in the kernel. It can be simply recognized through a message queue identifier. So this technique provides communication in between single otherwise numerous processes through full-duplex capacity.

Message Queue

Message Queue

Shared Memory

This is the memory that can be accessed simultaneously through several processes. So, the processes can simply communicate with each other. The following diagram demonstrates the shared memory IPC model. Both the processes like A & B will establish a shared memory segment & data can be exchanged through this shared memory region.

By default, the OS avoids processes from accessing other process memory. The processes would use a system call to define a memory as shared memory. In addition the process should synchronize with various synchronisation techniques available to use the other process shared memory.

Message Passing

It is a mechanism used to communicate & synchronize. By using this, the process communicates through each other without resorting to shared variables. So in this mode, processes communicate through messages with support from the underlying OS. In the following message passing diagram, two processes like A & B are interacting with each other with message passing.

Here, A Process sends a message like M to the OS kernel. After that, this message is read through process B. To exchange messages successfully, a communication link is required between the two processes. There are different methods through which these links are established.

Shared Memory & Message Passing

Shared Memory & Message Passing

Synchronization in Interprocess Communication

In an inter-process communication (IPC) synchronization is an essential part that is provided through either interprocess control mechanism otherwise handled through the communicating processes. There are some methods available to provide synchronization like the following.

Semaphore

Semaphore is one type of integer variable that controls the contact to a common resource through several processes. Semaphore variable is used to resolve the critical section problem & also to attain process synchronization within the multiprocessing environment.

So, is used to defend any resources like Global shared memory that has to be accessed & updated through several processes at once. Semaphore works like a guard or lock on the resources. Once a process needs to allow the resource, then first it has to take consent from the semaphore. So, semaphore gives consent to give access to a resource when the resource is free, or else the process needs to wait.
Semaphores are available in two types binary & counting. A binary semaphore is called a mutex lock.

Mutual Exclusion

This exclusion needs simply one process thread that can go into the critical segment at a time. So this is very useful for synchronization & also avoids race conditions.

This is one type of property for process synchronization which defines that no processes can exist within the critical section at any specified point in time. Any synchronization process method being used should satisfy the mutual exclusion property, otherwise, it is not achievable to eliminate a race condition.

A race condition is an undesirable condition that happens once a system or device tries to perform a number of operations simultaneously, but due to the system or device nature, the operations should be performed within the correct series to be done properly.

Barrier

A barrier does not permit separate processes to continue until every process reaches it. Barriers can be imposed by different parallel languages & collective routines.

A barrier means that the processes should stop at the barrier & cannot be allowed to continue until all processes from the group arrive at the barrier. Once the final process arrives at the barrier, then all processes can restart execution & carry on from the barrier.

Spinlock

Spinlock is one type of lock which is an execution of inter-thread locking through machine-dependent assembly instructions. Once processes attempt to get this lock, then it will stay in a loop to verify if the lock is existing or not. So this is called busy waiting because the process is not performing any functional operation although it is active. These are mainly used as an alternate for mutual exclusion locks because they perform better if locked for a short time period.

Why Inter-Process Communication?

There are many reasons to utilize IPC or inter-process communication for data sharing. Some of them include the following.

  • It assists in speedup modularity.
  • Privilege separation.
  • For sharing information.
  • For resource sharing.
  • Convenience.
  • Computational.
  • It helps the OS to interact with each other & also to synchronize their actions too.

Deadlock in OS

In an operating system, the situation takes place once any process moves into a waiting state as another waiting process is holding the demanded resource. So, deadlock is a common issue within multi-processing wherever various processes share an exact type of mutually exclusive resource called as software/soft lock.

Please refer to this link to know more about Deadlock in Operating System

Characteristics

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

Synchronous System Calls

Both sender & receiver within the synchronous system calls utilizes a blocking system for transmitting the data so that the sender will stay until the response is obtained from the receiver & the receiver stays until the message appears.

Asynchronous System Calls

Both the sender & receiver in asynchronous system calls utilize the non-blocking system to send the information which means the sender doesnt stay from the response of the receiver.

Destination of Message

A local port is a destination of a message in a computer that is specified like an integer. A port includes precisely one receiver however many senders. Programs or processes may utilize several ports from which to get messages. Any process can identify the number of a port to transmit the message to it.

Reliability

Reliability is defined as integrity & validity.

Integrity

Messages must appear without duplication & corruption to the destination.

Validity

Validity is if the messages are delivered without being lost.

Ordering

It is a method used to deliver messages toward the receiver within a specific order. Some applications need messages to be transmitted in the order of sender which means the order where they were transmitted through the sender.

Examples

The inter-process communication examples include the following.

  • Posix uses the shared memory technique.
  • Windows XP uses message passing technique.
  • Mach uses the message passing technique.
  • Pipes.
  • Server.

Advantages

The advantages of inter-process communication include the following.

  • Inter-process communication permits one application to manage another application, thus enabling data sharing devoid of interference.
  • This communication allows data communication through different processes to utilize semaphores, segments & other techniques to share data & memory.
  • Interprocess communication helps in transferring efficient messages in between processes.
  • We can almost avoid synchronization & named pipes blocking issues by sending a message.
  • We can look in advance through some way to the emergency note.
  • Data sharing is possible concurrently in between various programs.
  • The separation of tasks can be done into subtasks & run on special types of processors. After that, by using IPC data exchange can occur.
  • Programs maintain & debug is simple because it is divided into various code chunks which can work separately.
  • The programmer can execute different other tasks at the same time like editing, listening to music, compiling, etc.

Disadvantages

The disadvantages of inter-process communication include the following.

  • Similar to the pipe, every data block includes the highest limit of length.
  • Complete system data length for all blocks integrated within the queue also includes an upper limit.
  • All the processes or programs that utilize the model of shared memory need to check that they are not writing to a similar memory location.
  • A shared memory model may form issues like synchronization & protection of memory that require to be addressed.
  • As compared to straight function calls, it is slow.
  • Some problems related to synchronization & protection of memory may happen that must be resolved.
  • It does not let the programs write to a similar memory location.

Applications

The applications of inter-process communication include the following.

  • Inter-process communication is mainly used to exchange data in between several threads within a single or multiple programs/processes.
  • Interprocess communication is one type of mechanism that allows programs to interact with each other & synchronize their actions
  • IPC is essential in the design process of microkernels & nanokernels because Microkernels decrease different functionalities which are provided through the kernel. After that, these functionalities are attained by interacting with servers through IPC.
  • Interprocess communication is the key for an application design like a set of co-operating processes where every process handles one well-defined fraction of the whole.

Thus, this is all about an overview of inter-process communication which allows the data exchange in between programs or processes. This type of communication helps a programmer in arranging the activities between various processes by providing a set of programming interfaces. IPC allows data communication by letting different processes utilize different methods like segments, semaphores to transmit memory & data. Here is a question for you, what is an operating system?

Share This Post:

  • Facebook
  • Twitter
  • Google+
  • LinkedIn
  • Pinterest

Post navigation Previous Pneumatic System : Working & Its ApplicationsNext  What is NRF24L01 : Pin Configuration & Its WorkingRelated Content

PROFIBUS

What is Profibus : Working & Its Applications

Antenna Apertures

What is Aperture Antenna : Working & Its Applications

Horn Antenna

What is Horn Antenna : Working & Its Applications

Helical Antenna

What is Helical Antenna : Working & Its Applications

Add Comment Cancel reply

Comment:

Name *

Email *

Website

Δ

Video liên quan