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

# Compare RPC and RMI

Distributed System · Chapter 2: Distributed Objects and File System

- Asked in: 2075 Chaitra, 3+5 marks; 2072 Chaitra, 8+2 marks (asked 2 times)
- 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/rpc-vs-rmi
- Whole chapter: https://www.bctengineer.com/md/semester_7/distributed_system/chapter-2

## Question

What do you mean by RMI software? Comparatively discuss RPC with RMI. (Explain RMI with suitable diagram. How is RMI superior to RPC?)

## Short answer

RMI is the object-oriented extension of RPC, enabling method invocation on remote objects. Unlike RPC's procedural calls, RMI supports objects, inheritance, polymorphism, passing objects by reference, and distributed garbage collection, making it superior for complex distributed applications.

## Answer

#### RMI software
**Remote Method Invocation (RMI)** is the object-oriented extension of RPC. An object in one process invokes a method of an object in another process (possibly on another host) through a *remote object reference*. In Java, RMI is built into the language; CORBA does the same for many languages.

**Architecture**

```text
 Client                         Server
 +-------------+                +-------------+
 | Client obj  |                | Remote obj  |
 | Proxy (stub)|                | Skeleton    |
 | Remote ref  |<-- network --->| Dispatcher  |
 | module      |                | Remote ref  |
 | Comm module |                | Comm module |
 +-------------+                +-------------+
        ^        Remote reference module: translates local <-> remote refs
        +--- Object registry / naming service: look up by name
```

- **Proxy (stub):** local representative of the remote object; marshals arguments and sends the request.
- **Skeleton / dispatcher:** the dispatcher selects the method, and the skeleton unmarshals the request, calls the object and marshals the reply.
- **Remote reference module:** converts between local and remote object references.
- **Communication module:** carries request-reply messages with a chosen invocation semantics.
- **Registry / binder:** the client finds the remote object by name.

Java RMI example: the server defines an interface extending `java.rmi.Remote`, implements it and registers it in the RMI registry (`Naming.rebind`); the client calls `Naming.lookup` to get a stub and calls methods on it. The stub (and, in old versions, the skeleton) is generated by `rmic`, or dynamically by the runtime in modern 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 |

#### How RMI is superior
RMI supports objects, inheritance, polymorphism and passing objects as parameters, has a distributed garbage collector, gives better security (security manager, class loading) and allows a truly object-oriented design of distributed applications, which RPC cannot.

## Check yourself

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

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

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

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

4. Which component of RMI converts between local and remote object references?
   A. Remote reference module
   B. Proxy
   C. Registry
   D. Communication module
   Answer: A. The remote reference module translates local and remote references; the proxy marshals arguments. (Key point: RMI architecture)

## 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
- [Object communication; RPC vs RMI](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Aobjects-communicate-rpc-rmi) — 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
- [RMI functionalities; event notification](https://www.bctengineer.com/question.md?key=semester_7%2Fdistributed_system%3Armi-functionalities-events) — 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

## Related in other subjects

- [Compare software models; propose a fourth model](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Asw-models-compare-fourth) — Instrumentation II, chapter 9
- [Structured I/O software with diagram](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Astructured-io-software-diagram) — Operating System, chapter 6
- [Structured I/O software; SCAN vs SSTF](https://www.bctengineer.com/question.md?key=semester_6%2Foperating_system%3Astructured-io-software-scan-vs-sstf) — Operating System, chapter 6
- [Software reliability; waterfall vs prototyping; embedded software](https://www.bctengineer.com/question.md?key=semester_5%2Finstrumentation_ii%3Asw-reliability-models-embedded) — Instrumentation II, chapter 9
