IPC stands for Interprocess Communication. It is a medium for the communication of processes. It is a technique where an operating system allows all the independent processes to interact or communicate with each other within a single or multiple systems connected via a network. At the same time, it can handle many requests. Or we can also say that it is used for sharing data between multiple threads in one or more processes. They are used as abstract devices by processes, but in the operating system, they can be implemented in various ways.
Generally, operating systems use IPC to transfer a large amount of data. This technique can affect performance and energy consumption. It is not supported by a single process operating system like DOS.IPC synchronizes the requests to be implemented simultaneously. So, we can say that each and every individual process runs without affecting each other and the communication between them can be seen as a method of cooperation between them.
Characteristics of IPC
- Synchronus and Asynchronous communication:
Each message is queued, sending processes cause messages to be added to remote queues, and receiving processes remove messages from the local queues. This communication between these sending and receiving processes can be synchronous or asynchronous.
Both sending and receiving messages are synchronized at every message, in this case, both send and receive are blocking operation. If the message is sent by the sending process it remains blocked until the receive is issued by the receiving process and when the process receives the message it gets block until the next message arrives.
The use of the send operation is nonblocking, as the sending process sends the message the transmission of the message proceeds in parallel along with the sending process, receive operation can have both blocking and non-blocking variants. The receiving process immediately proceeds with its program after issuing a receive operation.
- Message destinations:
Message destination is a local port within the computer, specified as an integer. A port can have only one receiver and many senders.
Reliable communication can be defined in terms of validity and integrity.
For validity, point-to-point message service is defined as reliable if the messages are delivered securely without any drop or loss in packets.
For integrity, messages should arrive without any corruption and without duplication.
The requirement of some applications is that the messages should be delivered in sender order only, if the messages are out sender order then those messages should be considered as a failure by those applications.
- Sharing information because many processes are willing to share the same piece of information.
- Task can be divided into subtasks and can then run on a separate processor, and they can use IPC for exchanging information, this improves the execution of the program.
- Maintaining and debugging of the is easier as the program is divided into multiple chunks of code each performing functions separately.
- At the same time an individual user can perform multiple tasks. For example at the same time user can listen to music, can do editing, and compiling in parallel.
- It is slower than direct function calls.
- Because of IPC writing an OS piece needs writing some message passing APIs that must be taken into account.
- Problems like synchronization and memory protection can occur which needs to be addressed.
- The processes cannot write to the same memory location.
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.