- Asked 2/15
- 2075 Chaitra · 3+5 marks
- 2072 Chaitra · 8+2 marks
Compare RPC and RMI
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.
What do you mean by RMI software? Comparatively discuss RPC with RMI. (Explain RMI with suitable diagram. How is RMI superior to RPC?)
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
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.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Distributed object, IDL; RPC vs RMI · Distributed System, chapter 2
- Object communication; RPC vs RMI · Distributed System, chapter 2
- RPC vs RMI; modern RPC transparency · Distributed System, chapter 2
- RMI functionalities; event notification · Distributed System, chapter 2
- Middleware importance; RPC operation · Distributed System, chapter 2
- Compare software models; propose a fourth model · Instrumentation II, chapter 9
- Structured I/O software with diagram · Operating System, chapter 6
- Structured I/O software; SCAN vs SSTF · Operating System, chapter 6
- Software reliability; waterfall vs prototyping; embedded software · Instrumentation II, chapter 9