Communication Protocols in Operating Systems and Distributed Systems: IPC, RPC and a Worked Reliability Trace

Separate OS communication mechanisms from protocol guarantees, then trace how a lost reply, a retry, and request-ID deduplication affect server state.

KnowledgeGate Team

Exam prep & CS education

Updated 9 Nov 20266 min read
Communication Protocols in Operating Systems and Distributed Systems: IPC, RPC and a Worked Reliability Trace

send(), sockets, RPC, TCP and acknowledgements are often memorised as one list, even though they solve different parts of communication. That confusion makes it hard to decide whether a question is about an operating-system mechanism, a transport property or an application rule. A sound protocol separates the OS mechanism that moves data, the transport behaviour that moves bytes or messages, and the application rules that make retries safe.

Communication protocols: the contract behind every exchange

Communication moves information between processes. A protocol supplies three kinds of agreed rules. Syntax defines field layout and encoding. Semantics defines what each field means and what action follows. Timing defines when a message may be sent, retried, accepted or rejected.

A sender creates a message for a receiver through an endpoint and channel. Each process owns local state; shared state is accessible to multiple execution flows and needs coordination.

In local IPC, one kernel controls both processes. Distributed communication adds independent machines, a network and partial failure, so one side may fail while the other continues.

Use REQ(client=C, id=17, operation=ADD 5) as a tiny protocol grammar. The receiver must understand the field format, know that id=17 identifies this application request, and recognise that ADD 5 is non-idempotent. It must also know what to do if request 17 appears again.

Operating-system communication: shared memory, message passing and sockets

Model

Typical primitive

Where data lives

Coordination needed

Main risk

Shared memory

Mapped region

A region visible to both processes

Explicit mutex or semaphore

Data race

Pipes or message queues

Kernel-mediated messages

Kernel buffers

Blocking and queue-capacity rules

Waiting forever or a full queue

Sockets

Local or network endpoints

Endpoint buffers and private process memory

Framing, timeouts and failure handling

Partial data, duplicates or lost progress

send and receive are OS-facing operations. Blocking means the calling thread waits until the operation reaches its defined completion condition. Non-blocking means it returns without waiting. Neither term tells you whether delivery is reliable or best effort.

The GATE CS Exam category places IPC beside scheduling, memory and networking.

Side-by-side diagram of shared memory protected by mutex M and socket message passing, each changing a value from 20 to 25.

Distributed protocols: request-reply, RPC and the guarantees that matter

RPC makes remote work convenient, not local. Client code calls a stub, arguments are serialised, the request crosses the transport, the server handler runs, and a serialised reply returns. After a timeout, the client cannot tell whether the request was lost, the server is slow, or only the reply was lost.

Distributed Systems in Operating Systems connects lost replies to logical clocks, elections, replication and consistency. Distributed Systems Worked Examples carries the Lamport-clock, quorum and coordination calculations. At the communication boundary, the operative variables are the OS mechanism, transport behaviour, request identity and retry timing.

Axis

First choice

Second choice

What the axis asks

Connection

Connection-oriented

Connectionless

Is there an established association?

Caller waiting

Blocking

Non-blocking

Does the calling thread wait?

Interaction

Synchronous

Asynchronous

Is the result returned now or delivered later?

Order

Ordered

Unordered

Must messages be observed in sequence?

Delivery

Reliable

Best effort

What loss recovery does the layer provide?

One choice does not determine the others. Above the transport, an application protocol defines request fields, response meaning and retry rules. Application Layer Protocols: DNS and HTTP Guide gives concrete examples.

Communication protocol worked example: a lost reply and one retry

The counter starts at 20. C sends REQ(C,17,ADD 5) at t=0 ms. One-way delay is 30 ms, processing takes 10 ms, reply delay is 30 ms, and timeout is 100 ms.

With no loss, the request arrives at 0 + 30 = 30 ms. The server finishes at 30 + 10 = 40 ms, changes the counter to 25, and the reply arrives at 40 + 30 = 70 ms. The normal round trip is 70 ms.

Now lose the first reply after the update commits at t=40 ms. C retransmits the identical request at t=100 ms, and it reaches S at 100 + 30 = 130 ms. A naive server repeats ADD 5, finishes at 130 + 10 = 140 ms, changes 25 to 30, and returns a reply at 140 + 30 = 170 ms. Communication recovered, but the application state is wrong.

For at-most-once execution, S stores (client=C, id=17) -> result 25 when the first update commits. At t=130 ms, it finds the duplicate key, skips ADD 5, and immediately resends cached REP(17,25). That reply arrives at 130 + 30 = 160 ms, and the final counter remains 25.

Message-sequence chart of request 17: the first reply is lost, the retry returns cached result 25 at 160 ms, and duplicate addition is rejected.

Delivery semantics: at-least-once, at-most-once and the exactly-once trap

Policy

Execution guarantee

Observed counter in this example

No retry

Zero or one execution

20 if the request is lost, otherwise 25

Retry without deduplication, assuming eventual delivery

One or more executions

Can become 30 after one duplicate execution

Request-ID deduplication

At most one execution

25 when request 17 arrives and commits

Idempotent operations are safer under retries. Repeating SET counter=25 leaves 25; repeating ADD 5 can produce 25 and then 30.

Exactly-once is an end-to-end application claim, not a TCP property. Surviving a server crash requires a durable request-ID and result record, atomically tied to the business update. Otherwise the server can update the counter but crash before recording completion.

Communication protocol traps: what each shortcut gets wrong

A timeout shows only that the client did not observe progress before its deadline. It does not prove non-execution. A transport acknowledgement confirms transport progress, not that the handler committed ADD 5. A reliable byte stream does not preserve message boundaries, so the application must add framing.

Transport sequence numbers cannot replace id=17 across retries and reconnects. Messages may be duplicated or reordered. Serialisation must define byte order, field lengths and version handling.

The duplicate cache and the counter are shared server state. Concurrent handlers must update them safely and atomically. Local mutexes or semaphores coordinate those handlers; they do not solve distributed retries.

Communication protocols in exams: classification, traces and statement traps

The GATE 2026 syllabus placed inter-process communication under Operating Systems, while UDP, TCP, sockets and application-layer protocols appeared under Computer Networks. Check the current organising institute's syllabus before treating that split as current.

Questions may classify shared memory and message passing, match primitives to blocking behaviour, compare guarantees, trace request-reply events, or test the claim “timeout means the operation did not execute”.

Now change only the timeout to 60 ms and lose nothing. The normal round trip remains 30 + 10 + 30 = 70 ms. The retry leaves C at t=60 ms, the original reply arrives at t=70 ms, and the already-sent retry reaches S at 60 + 30 = 90 ms. A naive server finishes the second ADD 5 at 90 + 10 = 100 ms and leaves the counter at 30. Duplicate suppression leaves it at 25. A short timeout can therefore create a duplicate even without message loss.

Communication protocols: the short version and next step

For any communication problem, ask four questions: What IPC mechanism carries the data? Does the call block? What delivery and ordering guarantees exist? How are duplicates and crashes handled? Apply them to pipes, queues, sockets and RPC.

For connected CS fundamentals, Zero to Hero Complete CS Course is the structured next step. If you only want to master this topic now, redraw the id=17 trace and solve the 60 ms timeout variation first.