---
title: "RPC and its communication semantics"
subject: "Distributed System"
chapter: 2
key: "semester_7/distributed_system:rpc-semantics"
source: https://www.bctengineer.com/q/semester_7/distributed_system/rpc-semantics
site: BCT Engineering
---

# RPC and its communication semantics

Distributed System · Chapter 2: Distributed Objects and File System

- Asked in: 2074 Chaitra, 2+6 marks; 2071 Shrawan, 4 marks; 2076 Asoj (asked 3 times)
- Video: [RPC Semantics in the  presence of Failure](https://www.youtube.com/watch?v=GD27BAFTIx0) — Norman Dias
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/rpc-semantics
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-2

## Question

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

## 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).

## Answer

#### 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.

| Semantics | Fault tolerance measures | Meaning |
|---|---|---|
| **Maybe** | No retransmission, no filtering | Procedure may be executed once or not at all; client cannot know |
| **At-least-once** | Retransmit request; no duplicate filtering; re-execute procedure | Executed one or more times; if the result arrives, it ran at least once. Suited for idempotent operations |
| **At-most-once** | Retransmit request, filter duplicates, retransmit stored reply | Either 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 server | Executed 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).

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. What does 'maybe' call semantics guarantee?
   A. It is executed exactly once
   B. The procedure may be executed once or not at all; there is no retransmission and the client cannot know
   C. It is executed at least once
   D. It is retransmitted until a reply arrives
   Answer: B. Maybe uses no fault-tolerance measures. (Key point: Maybe semantics)

2. Which operation suits at-least-once semantics?
   A. An idempotent one such as reading block 5
   B. Depositing Rs 100 into an account
   C. Any operation changing a counter
   D. A non-repeatable payment
   Answer: A. Re-executing an idempotent operation is harmless, but a deposit would be repeated. (Key point: At-least-once)

3. How does at-most-once semantics avoid running a retransmitted request twice?
   A. The client never retransmits
   B. The server re-executes and discards the older result
   C. A request identifier is used and the server keeps a history of replies, returning the stored reply for duplicates
   D. The server crashes and restarts
   Answer: C. Duplicate filtering with stored replies gives execution once or not at all. (Key point: At-most-once mechanism)

4. Which semantics is the common choice in Java RMI and CORBA?
   A. Maybe
   B. At-least-once
   C. Exactly-once
   D. At-most-once
   Answer: D. Exactly-once is ideal but hard to guarantee; at-most-once is common. (Key point: Used where)

## Related in Distributed System

- [Reliable client-server communication](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Areliable-client-server) — Distributed System, chapter 9
- [Distributed object, IDL; RPC vs RMI](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aobject-idl-rpc-rmi) — Distributed System, chapter 2
- [Object communication; RPC vs RMI](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aobjects-communicate-rpc-rmi) — Distributed System, chapter 2
- [Middleware importance; RPC operation](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Arpc-middleware-operation) — Distributed System, chapter 2
- [Distributed objects and communication](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Adistributed-objects-communication) — Distributed System, chapter 2, asked 2×
- [Access transparency and modern RPC](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Amodern-rpc-access-transparency) — Distributed System, chapter 2

## Related in other subjects

- [Client-server versus distributed object architecture](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aclient-server-vs-distributed-object) — Software Engineering, chapter 3
- [Client-side versus server-side scripting](https://www.bctengineer.com/question.md?key=semester_7%2Fweb_technology%3Aclient-vs-server-side-scripting) — Web Technology, chapter 3, asked 3×
- [Server before client; TCP reliability](https://www.bctengineer.com/question.md?key=semester_7%2Fcomputer_networks_and_security%3Atcp-server-before-client-reliability) — Computer Networks and Security, chapter 5, asked 2×
- [Short note: Client-Server and Master-Slave](https://www.bctengineer.com/question.md?key=semester_8%2Fbig_data_technologies%3Ashort-note-client-server-master-slave) — Big Data Technologies, chapter 1
