A Beginner's Guide to Inter-Process Communication (IPC)

Inter-process communication (IPC) deals with techniques and mechanisms provided by operating systems, by which multiple threads in one or more processes exchange data with each other.

Prove you're a Dev Guru! Take the test now!

These processes are not bound to one computer, and can run on various computers connected by network. Inter-process communication techniques can be divided into various types. These are:

1. Pipes


3. Shared memory

4. Mapped memory

5. Message queues

6. Sockets

Pipes: The most basic versions of the UNIX operating system gave birth to pipes. These were used to facilitate one-directional communication between single-system processes. We can create a pipe by using the pipe system call, thus creating a pair of file descriptors

FIFO: A FIFO or 'first in, first out' is a one-way flow of data. FIFOs are similar to pipes, the only difference being that FIFOs are identified in the file system with a name. In simple terms, FIFOs are 'named pipes'.

Shared memory: Shared memory is an efficient means of passing data between programs. An area is created in memory by a process, which is accessible by another process. Therefore, processes communicate by reading and writing to that memory space.

Mapped memory: This method can be used to share memory or files between different processors in a Windows environment. A 32-bit API can be used with Windows. This mechanism speeds up file access, and also facilitates inter-process communication.

Message queues: By using this method, a developer can pass messages between messages via a single queue or a number of message queues. A system kernel manages this mechanism. An application program interface (API) coordinates the messages.

Sockets: We use this mechanism to communicate over a network, between a client and a server. This method facilitates a standard connection that is independent of the type of computer and the type of operating system used.

Microsoft introduced .NET Remoting Framework for communication between applications. Objects in .NET are exposed to remote processes, thus allowing inter-process communication. These processes can be on the same computer or come from computers connected to each other via a network. Remoting in .NET consists of a 'server' and a 'client'. A remotable object is passed to expose the desired functionality between them.

The .NET Remoting Framework provides powerful and scalable methods for inter-process communication. It effortlessly integrates with web services, and provides a way to expose .NET objects for access across multiple platforms.