The Wayback Machine - https://web.archive.org/web/20241001051838/https://www.geeksforgeeks.org/methods-in-interprocess-communication/
Open In App

Methods in Interprocess Communication

Last Updated : 24 Mar, 2023
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Save
Share
Report
News Follow

Prerequisite – Inter Process Communication, Inter-process communication (IPC) is set of interfaces, which is usually programmed in order for the programs to communicate between series of processes. This allows running programs concurrently in an Operating System. These are the methods in IPC:

  1. Pipes (Same Process) – This allows flow of data in one direction only. Analogous to simplex systems (Keyboard). Data from the output is usually buffered until input process receives it which must have a common origin.
  2. Names Pipes (Different Processes) – This is a pipe with a specific name it can be used in processes that don’t have a shared common process origin. E.g. is FIFO where the details written to a pipe is first named.
  3. Message Queuing – This allows messages to be passed between processes using either a single queue or several message queue. This is managed by system kernel these messages are coordinated using an API.
  4. Semaphores – This is used in solving problems associated with synchronization and to avoid race condition. These are integer values which are greater than or equal to 0.
  5. Shared memory – This allows the interchange of data through a defined area of memory. Semaphore values have to be obtained before data can get access to shared memory.
  6. Sockets – This method is mostly used to communicate over a network between a client and a server. It allows for a standard connection which is computer and OS independent.

Interprocess communication (IPC) refers to the mechanisms and techniques used by operating systems to allow different processes to communicate with each other. There are several methods of IPC, each with its own advantages and disadvantages. Some common methods of IPC include:

  1. Pipes: A pipe is a unidirectional communication channel used for IPC between two related processes. One process writes to the pipe, and the other process reads from it.
  2. Message Queues: Message queues are used to send and receive messages between processes. They can be used for both one-to-one and one-to-many communication.
  3. Shared Memory: Shared memory is a technique where multiple processes can access the same region of memory. This allows for high-speed communication between processes.
  4. Semaphores: Semaphores are used for controlling access to shared resources. They are used to prevent multiple processes from accessing the same resource simultaneously, which can lead to data corruption.
  5. Sockets: Sockets are used for network communication between processes running on different hosts. They provide a standard interface for communication, which can be used across different platforms and programming languages.

Remote Procedure Calls (RPC): RPC is a technique used for distributed computing. It allows processes running on different hosts to call procedures on each other as if they were running on the same host.

Each method of IPC has its own advantages and disadvantages, and the choice of which method to use depends on the specific requirements of the application. For example, if high-speed communication is required between processes running on the same host, shared memory may be the best choice. On the other hand, if communication is required between processes running on different hosts, sockets or RPC may be more appropriate.



Similar Reads

Communication between two process using signals in C
Prerequisite : C signal handling In this post, the communication between child and parent processes is done using kill() and signal(), fork() system call. fork() creates the child process from the parent. The pid can be checked to decide whether it is the child (if pid == 0) or the parent (pid = child process id).The parent can then send messages t
3 min read
What is Space Communication?
Pre-requisites: Data Communication Space communication refers to the transmission of information or data between different points in space using various communication technologies. It involves the use of satellites, spacecraft, and ground-based facilities to transmit and receive signals for various purposes, such as scientific research, military an
6 min read
Inter-process Communication using a shared stack
Inter Process Communication through shared memory is a concept where two or more process can access the common memory.the communication is done via this shared memory where changes made by one process can be viewed by another process. So, we can use one stack as a shared memory, where users(processes) sharing the stack (stacks) can push or pop elem
8 min read
Traditional wireless mobile communication
A Cellular device today has become unthinkingly an extension of our anthropological arms that has endowed us with an added means of communication, which we term as wireless communication or mobile telecommunication. A few millimeters sized SIM card plugged into a mobile device forms a worldwide used network technology called the Global System for M
4 min read
Communication Models in IoT (Internet of Things )
IoT devices are found everywhere and will enable circulatory intelligence in the future. For operational perception, it is important and useful to understand how various IoT devices communicate with each other. Communication models used in IoT have great value. The IoTs allow people and things to be connected any time, any space, with anything and
3 min read
Transmission Impairment in Data Communication
In communication system, analog signals travel through transmission media, which tends to deteriorate the quality of analog signal, which means that the signal at the beginning of the medium is not the same as the signal at the end of the medium. The imperfection causes signal impairment. Below are the causes of the impairment.Causes of impairment
3 min read
jQuery | Hide/Show, Toggle and Fading methods with Examples
jQuery provides a trivially simple interface for doing various kind of amazing effects. jQuery methods allow us to quickly apply commonly used effects with a minimum configuration. jQuery hide() and show() jQuery hide() : Hides the Syntax or the element of html that you want to hide.$(selector).hide(speed, callback); jQuery show() : Shows the synta
3 min read
C++: Methods of code shortening in competitive programming
Shortcode is ideal in competitive programming because programs should be written as fast as possible. Because of this, competitive programmers often define shorter names for datatypes and other parts of the code. We here discuss the method of code shortening in C++ specifically.Type names Using the command typedef it is possible to give a shorter n
5 min read
Difference between the Constructors and Methods
Java is a pure OOPS concept based programming language. Hence in Java, all the variables, data and the statements must be present in classes. These classes consist of both constructors and methods. Methods and Constructors are different from each other in a lot of ways. Constructors: Constructors are used to initialize the object's state. Like meth
3 min read
Interpolation Methods in Computer Graphics
Interpolation is a method of constructing new data points within range of discrete set of known data points. The number of data points obtained by sampling or experimentation represents values of function for limited number of values of independent variable. The main task of Interpolation is to find suitable mathematical expression for known curve.
2 min read
Scan conversion methods of circle and circle generation algorithms
Scan conversion of circle : A circle is defined as a set of points that all are the same distance from a common point.The Centre of the circle is known as the Centre, and the radius is the distance from the Centre of the circle to any point on its circumference.It's an eight-sided symmetrical figure divided into four quadrants. By knowing only one
3 min read
File Allocation Methods
The allocation methods define how the files are stored in the disk blocks. There are three main disk space or file allocation methods. Contiguous Allocation Linked Allocation Indexed Allocation The main idea behind these methods is to provide: Efficient disk space utilization. Fast access to the file blocks. All the three methods have their own adv
5 min read
Different ways to iterate over a set in C++
Sets are a type of associative container in which each element has to be unique because the value of the element identifies it. The values are stored in a specific order. Syntax: set<datatype> setname; Here,Datatype: Set can take any data type depending on the values, e.g. int, char, float, etc. This article focuses on discussing all the meth
5 min read
Analysis of Algorithms | Big - Θ (Big Theta) Notation
In the analysis of algorithms, asymptotic notations are used to evaluate the performance of an algorithm, in its best cases and worst cases. This article will discuss Big - Theta notations represented by a Greek letter (Θ). Definition: Let g and f be the function from the set of natural numbers to itself. The function f is said to be Θ(g), if there
6 min read
Vector of Vectors in C++ STL with Examples
Prerequisite: Vectors in C++ STL Vectors are known as dynamic arrays with the ability to resize itself automatically when an element is inserted or deleted, with their storage being handled automatically by the container. Vector of Vectors is a two-dimensional vector with a variable number of rows where each row is vector. Each index of vector stor
5 min read
Features of C Programming Language
C is a procedural programming language. It was initially developed by Dennis Ritchie in the year 1972. It was mainly developed as a system programming language to write an operating system. The main features of C language include low-level access to memory, a simple set of keywords, and a clean style, these features make C language suitable for sys
3 min read
For Loop in Java
Loops in Java come into use when we need to repeatedly execute a block of statements. Java for loop provides a concise way of writing the loop structure. The for statement consumes the initialization, condition, and increment/decrement in one line thereby providing a shorter, easy-to-debug structure of looping. Let us understand Java for loop with
7 min read
Java do-while loop with Examples
Loops in Java come into use when we need to repeatedly execute a block of statements. Java do-while loop is an Exit control loop. Therefore, unlike for or while loop, a do-while check for the condition after executing the statements of the loop body. Syntax: do { // Loop Body Update_expression } // Condition check while (test_expression); Note: The
5 min read
C fopen() function with Examples
The fopen() method in C is a library function that is used to open a file to perform various operations which include reading, writing, etc. along with various modes. If the file exists then the fopen() function opens the particular file else a new file is created. SyntaxThe syntax of C fopen() is: FILE *fopen(const char *file_name, const char *mod
4 min read
Structures in C++
We often come around situations where we need to store a group of data whether of similar data types or non-similar data types. We have seen Arrays in C++ which are used to store set of data of similar data types at contiguous memory locations.Unlike Arrays, Structures in C++ are user defined data types which are used to store group of items of non
5 min read
Building Heap from Array
Given an array of N elements. The task is to build a Binary Heap from the given array. The heap can be either Max Heap or Min Heap. Examples: Input: arr[] = {4, 10, 3, 5, 1}Output: Corresponding Max-Heap: 10 / \ 5 3 / \4 1 Input: arr[] = {1, 3, 5, 4, 6, 13, 10, 9, 8, 15, 17}Output: Corresponding Max-Heap: 17 / \ 15 13 / \ / \ 9 6 5 10 / \ / \ 4 8 3
14 min read
Insertion and Deletion in Heaps
Deletion in Heap:Given a Binary Heap and an element present in the given Heap. The task is to delete an element from this Heap. The standard deletion operation on Heap is to delete the element present at the root node of the Heap. That is if it is a Max Heap, the standard deletion operation will delete the maximum element and if it is a Min heap, i
15+ min read
Data encryption standard (DES) | Set 1
This article talks about the Data Encryption Standard (DES), a historic encryption algorithm known for its 56-bit key length. We explore its operation, key transformation, and encryption process, shedding light on its role in data security and its vulnerabilities in today's context. What is DES?Data Encryption Standard (DES) is a block cipher with
15+ min read
Priority Queue in Python
Priority Queues are abstract data structures where each data/value in the queue has a certain priority. For example, In airlines, baggage with the title “Business” or “First-class” arrives earlier than the rest. Priority Queue is an extension of the queue with the following properties. An element with high priority is dequeued before an element wit
2 min read
Block Cipher modes of Operation
Encryption algorithms are divided into two categories based on the input type, as a block cipher and stream cipher. Block cipher is an encryption algorithm that takes a fixed size of input say b bits and produces a ciphertext of b bits again. If the input is larger than b bits it can be divided further. For different applications and uses, there ar
5 min read
Java Math min() method with Examples
The Java.lang.math.min() function is an inbuilt function in java that returns the minimum of two numbers. The arguments are taken in int, double, float and long. If a negative and a positive number is passed as an argument then the negative result is generated. And if both parameters passed are negative then the number with the higher magnitude is
2 min read
Containers in C++ STL (Standard Template Library)
A container is a holder object that stores a collection of other objects (its elements). They are implemented as class templates, which allows great flexibility in the types supported as elements. The container manages the storage space for its elements and provides member functions to access them, either directly or through iterators (reference ob
2 min read
Phases of a Compiler
Prerequisite - Introduction of Compiler design We basically have two phases of compilers, namely the Analysis phase and Synthesis phase. The analysis phase creates an intermediate representation from the given source code. The synthesis phase creates an equivalent target program from the intermediate representation. A compiler is a software program
7 min read
goto Statement in C
The C goto statement is a jump statement which is sometimes also referred to as an unconditional jump statement. The goto statement can be used to jump from anywhere to anywhere within a function. Syntax: Syntax1 | Syntax2 ---------------------------- goto label; | label: . | . . | . . | . label: | goto label; In the above syntax, the first line te
3 min read
dup() and dup2() Linux system call
dup() The dup() system call creates a copy of a file descriptor. It uses the lowest-numbered unused descriptor for the new descriptor. If the copy is successfully created, then the original and copy file descriptors may be used interchangeably. They both refer to the same open file description and thus share file offset and file status flags. Synta
3 min read
Article Tags :
Practice Tags :