Skip to main content

Object communication; RPC vs 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.

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

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

PointRPCRMI
ParadigmProcedure orientedObject oriented
What is calledA remote procedure/functionA method of a remote object
ParametersOrdinary data, passed by value (structures)Objects too, passed by value (serialised) or by remote reference
Object identityNoneRemote object references identify objects
StateProcedures usually without object stateMethods work on the state of an object
LanguageUsually language independent (C, XDR)Java RMI is Java only; CORBA is language independent
InterfaceIDL such as Sun XDR/rpcgenJava interface or CORBA IDL
Garbage collectionNot applicableDistributed garbage collection of remote objects
Polymorphism, inheritanceNot supportedSupported
UseProcedural client-serverComplex distributed object applications

✓ Answer checked by Claude Opus 5.5 (high effort)

All Distributed System chapter 2 questions →