Question 4 of 15 · CIE-1 QB · 7 marks
Open in ChatGPTExplain inter-process communication mechanisms in Distributed Systems. Discuss the different methods used for IPC.
Introduction
Processes in a distributed system run in separate address spaces on separate machines, so they cannot share variables. Inter-process communication (IPC) is the set of mechanisms that lets them exchange data, and everything else in a distributed system is built on top of it.
Two families
- Message-based (no shared memory). The processes exchange explicit messages: sockets, message queues, RPC, RMI, MPI, publish-subscribe.
- Shared-memory based. Valid only on one machine: shared memory segments, pipes, memory-mapped files. They are used inside a node, not across a network.
Methods used for IPC
- Berkeley sockets. The lowest-level network interface: a process writes to a socket addressed by IP address and port. Connectionless (UDP), connection-oriented (TCP) and raw sockets. Nearly every other mechanism is built on sockets.
- Remote Procedure Call (RPC). Hides the network behind a normal procedure call, using client and server stubs and a marshalling format (an IDL such as XDR or gRPC's protobuf).
- Remote Method Invocation (RMI). The object-oriented form of RPC: a method on a remote object is invoked through a proxy.
- Message-oriented middleware (MOM). A message queue between sender and receiver, so they are decoupled in time. The sender does not need the receiver to be running. Examples: RabbitMQ, Kafka.
- Message Passing Interface (MPI). Point-to-point and collective operations designed for clusters:
send,recv,broadcast,reduce. - Stream-oriented communication. A continuous flow of bytes or audio/video between sender and receiver, with timing constraints for multimedia.
- Publish-subscribe. Publishers post to a topic and subscribers receive every message on it; used for events and feeds.
Diagram
Synchronous vs asynchronous
| Mode | Sender behaviour | Uses |
|---|---|---|
| Synchronous | Blocks until the receiver accepts or replies | RPC, request-reply |
| Asynchronous | Continues immediately; the reply arrives later or never | Message queues, publish-subscribe, one-way messaging |
The receiver's buffer decides whether a sender can proceed: zero-capacity (rendezvous) forces the sender to wait; bounded or unbounded buffering lets it continue.
Example
A ticket-booking site uses sockets (HTTPS) between browser and web server, RPC between the web server and the booking service, and a message queue to hand the confirmed booking to the email service. The queue lets the booking succeed even when the mail server is temporarily down.
Conclusion
IPC is chosen by coupling and timing: sockets for control over the wire, RPC and RMI for program-like calls, queues and publish-subscribe when sender and receiver must not wait for each other.