Skip to main content

RPC and its communication semantics

Short answer

RPC lets a program call a remote procedure as if it were local. Communication semantics include maybe (no retransmission, may execute 0 or 1 time), at-least-once (retransmit, may execute multiple times), and at-most-once (retransmit with duplicate filtering, executes once or not at all).

Define Remote Procedure Call (RPC). Describe various RPC communication semantics of client server communication in distributed system.

Definition

Remote Procedure Call (RPC) lets a program call a procedure that runs in another address space, normally on another computer, with the same syntax as a local call. The network communication is hidden from the programmer.

RPC communication semantics

When a client calls a remote procedure, the request or reply message may be lost, or the server may crash. RPC systems offer different call (invocation) semantics depending on how they use retransmission, duplicate filtering and re-execution.

SemanticsFault tolerance measuresMeaning
MaybeNo retransmission, no filteringProcedure may be executed once or not at all; client cannot know
At-least-onceRetransmit request; no duplicate filtering; re-execute procedureExecuted one or more times; if the result arrives, it ran at least once. Suited for idempotent operations
At-most-onceRetransmit request, filter duplicates, retransmit stored replyEither executed exactly once (result received), or not at all (exception). Used by most RPC/RMI systems
Exactly-once (ideal)Needs fault-tolerant recovery of the serverExecuted exactly once even with failures; hard to guarantee

Details

  • Maybe is used where occasional loss is tolerable (e.g. status updates).
  • At-least-once is simple; repeating an operation such as "read block 5" is harmless (idempotent), but "deposit Rs 100" would be repeated. Sun RPC, used by NFS, provides this.
  • At-most-once uses a request identifier; the server keeps a history of replies, so a retransmitted request gets the stored reply instead of being executed again. This is the usual choice in Java RMI and CORBA.

The failures these semantics must deal with are: lost request, lost reply, server crash before or after execution, and client crash (orphans).

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 2 questions →