---
title: "Object communication; RPC vs RMI"
subject: "Distributed System"
chapter: 2
key: "semester_7/distributed_system:objects-communicate-rpc-rmi"
source: https://www.bctengineer.com/q/semester_7/distributed_system/objects-communicate-rpc-rmi
site: BCT Engineering
---

# Object communication; RPC vs RMI

Distributed System · Chapter 2: Distributed Objects and File System

- Asked in: 2070 Asar, 4+4 marks
- Video: [3. Difference Between RPC and RMI Explained | RPC vs RMI | Distributed Computing Notes](https://www.youtube.com/watch?v=4wGaFkRpwxE) — OnTimeNotes
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_7/distributed_system/objects-communicate-rpc-rmi
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-2

## Question

Explain the ways how distributed objects communicate with each other. Differentiate between RPC and RMI.

## Short answer

Distributed objects communicate via RMI, RPC, message passing, publish-subscribe events, and group multicast. RPC is procedure-oriented and calls a remote function with ordinary data; RMI is object-oriented and calls a method on a remote object, supporting object references, state, distributed garbage collection, and polymorphism.

## Answer

#### How distributed objects communicate
Distributed objects communicate in these ways.

1. **Remote method invocation (RMI):** a client holding a remote reference calls a method through a *proxy*; the *skeleton/dispatcher* at the server calls the object. Request-reply protocol with call semantics (at-most-once), as in Java RMI and CORBA.
2. **Remote procedure call (RPC):** procedural communication through stubs, used with non-object servers.
3. **Message passing:** direct send/receive messages (sockets, message queues).
4. **Event notification (publish-subscribe):** an object of interest publishes events and subscribers get notification asynchronously (Jini distributed events, CORBA event service).
5. **Group (multicast) communication** for replicated objects.

```text
 Client obj -> Proxy -> Request ----> Skeleton -> Remote obj
            <-        <-  Reply  <----
```
Marshalling converts arguments and results to a common external form (CDR in CORBA, serialisation in Java).

#### RPC versus RMI
| Point | RPC | RMI |
|---|---|---|
| Paradigm | Procedure oriented | Object oriented |
| What is called | A remote procedure/function | A method of a remote object |
| Parameters | Ordinary data, passed by value (structures) | Objects too, passed by value (serialised) or by remote reference |
| Object identity | None | Remote object references identify objects |
| State | Procedures usually without object state | Methods work on the state of an object |
| Language | Usually language independent (C, XDR) | Java RMI is Java only; CORBA is language independent |
| Interface | IDL such as Sun XDR/rpcgen | Java interface or CORBA IDL |
| Garbage collection | Not applicable | Distributed garbage collection of remote objects |
| Polymorphism, inheritance | Not supported | Supported |
| Use | Procedural client-server | Complex distributed object applications |

## Check yourself

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

1. How does event notification (publish-subscribe) differ from RMI?
   A. The client blocks waiting for a reply
   B. It uses stubs and skeletons only
   C. Subscribers are notified asynchronously when the object of interest publishes an event
   D. It cannot involve more than one receiver
   Answer: C. Events are pushed asynchronously rather than invoked by request-reply. (Key point: Event notification)

2. Which call semantics does RMI request-reply typically use, as in Java RMI and CORBA?
   A. Maybe
   B. At-least-once
   C. Exactly-once
   D. At-most-once
   Answer: D. A request id and reply history filter duplicates. (Key point: Invocation semantics)

3. What is the basic difference between RPC and RMI?
   A. RPC calls a remote procedure; RMI calls a method of a remote object
   B. RPC is object oriented; RMI is procedure oriented
   C. RPC works only on one host; RMI works across hosts
   D. RMI has no stubs while RPC uses stubs
   Answer: A. RMI is the object-oriented extension of RPC. (Key point: Paradigm)

4. Which is true of RMI but not of RPC?
   A. Only ordinary data can be passed as parameters
   B. There is no concept of object identity
   C. Remote object references identify objects and objects can be passed by value or by remote reference
   D. It does not need an interface definition
   Answer: C. RPC passes plain data; RMI adds remote object references and serialised objects. (Key point: Object identity and parameters)

5. Which features does RMI support that RPC does not?
   A. Marshalling of arguments
   B. Use of an interface definition language
   C. Client and server stubs
   D. Inheritance, polymorphism and distributed garbage collection
   Answer: D. These object-oriented features and distributed GC are what make RMI superior. (Key point: Advanced features)

## Related in Distributed System

- [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
- [DFS; RMI communication between objects](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Armi-dfs-comm) — Distributed System, chapter 2
- [RPC vs RMI; modern RPC transparency](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Adifferentiate-rpc-modern-rpc) — 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×
- [Compare RPC and RMI](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Arpc-vs-rmi) — Distributed System, chapter 2, asked 2×
- [RPC and its communication semantics](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Arpc-semantics) — Distributed System, chapter 2, asked 3×
