0% found this document useful (0 votes)
21 views5 pages

What Is RPC RMI

Remote Procedure Call (RPC) allows a client on one machine to call a procedure on a server on another machine, with parameters being passed transparently. The document outlines the principles and steps involved in RPC, including stubs for client and server, as well as asynchronous and deferred asynchronous RPCs. It also introduces Remote Method Invocation (RMI), which builds on RPC principles using object-oriented programming, and discusses the challenges associated with RPCs and RMIs, particularly in terms of server availability and client blocking.

Uploaded by

murugifiona28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views5 pages

What Is RPC RMI

Remote Procedure Call (RPC) allows a client on one machine to call a procedure on a server on another machine, with parameters being passed transparently. The document outlines the principles and steps involved in RPC, including stubs for client and server, as well as asynchronous and deferred asynchronous RPCs. It also introduces Remote Method Invocation (RMI), which builds on RPC principles using object-oriented programming, and discusses the challenges associated with RPCs and RMIs, particularly in terms of server availability and client blocking.

Uploaded by

murugifiona28
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

DS notes SET 2

What is RPC?
When a process on machine A (or client) calls a procedure on machine B (or server), the calling
process on A is suspended, and execution of the called procedure takes place on B.
Information can be transported from the caller to callee in the parameters and can come back in
the procedure result.
Programmers cannot see message passing at all (transparency). This method is known as Remote
Procedure Call or RPC. RPC is supported by middleware communication services. RPC was
initially implemented using C. Principle of RPC between a client and server
(1) Principle of RPC between a client and server
(2) General structure of RPC

Stub is a small chunk of C code that is compiled and linked into the client and server programs.
Client stub converts parameters into a string of bits and sends the message over the network.
Server stub takes the message, converts it back into parameters, and then calls the server.
Packing parameters into a message is called parameter marshaling.
Steps of a Remote Procedure Call
i. Client procedure calls client stub in normal way
ii. Client stub builds message, calls local OS
iii. Client's OS sends message to remote OS

1
iv. Remote OS gives message to server stub
v. Server stub unpacks parameters, calls server

vi. Server does work, returns result to the stub


vii. Server stub packs it in message, calls local OS
viii. Server's OS sends message to client's OS
ix. Client's OS gives message to client stub
x. Stub unpacks result, returns to client

Asynchronous RPC Asynchronous RPC


i. Client sends a request to server.
ii. Server sends back a reply immediately after receiving the request, and then starts processing the
request.
iii. Client starts doing new work without further blocking after receiving the server’s reply (as an
acknowledgement). Asynchronous RPC is useful when there is no result to return from server (e.g.
transferring money from one account to another, adding new entries to a database).
Deferred Asynchronous RPC A client and server interacting through two asynchronous RPCs

2
Deferred

Deferred Asyn
It is a combination of two asynchronous RPCs.
Asynchronous RPC is useful when there is a result to be returned from server but client is not
prepared to wait for it and starts doing something else (eg remote computing).
One-Way RPC
Client does not wait for an acknowledgement from server and starts doing something else
immediately after sending the request.
REMOTE METHOD INVOCATION
From Procedures to Objects
Object hides its internals from outside world by means of a well-defined interface, which allows
objects to be easily replaced or adapted whereas the interface remains the same. (partial
modification)
An object encapsulates data (state), and the operations on those data (methods). Methods are
made available through an interface. The state of the object can only be accessed by invoking
methods through the interface. (simple and unique access)
An object may have many interfaces. Likewise, an interface definition may be implemented by
several objects. (multiple implementations)
The separation between interfaces and the objects implementing these interfaces allows an
interface to be placed at one machine, and the object itself to reside on another machine.
(distributed objects)

3
What is RMI?
RMI uses the same principle as RPC.
Distributed objects are implemented using object-oriented programming languages (C++ or
Java), rather than C.
It uses method invocation to perform processes, instead of procedure call. Development of RMI
applications is supported by many distributed object-based middleware, such as CORBA and
DCOM. General structure of RMI Note Important Terminologies
Proxy (client stub) is an implemented interface (on client machine) of a distributed object (on
server machine). It marshals method invocations into messages and unmarshals reply messages
to return the invocated results to the client. The remote object also has the same interface.
Skeleton (server stub) unmarshals incoming invocation requests to proper method invocations at
the object’s interface. It also marshals and forwards reply message to client proxy.
RMI operation: Steps in Making RMI (one-way)

i. Client invokes a method through the interface (handled by client Proxy) that is as same as that
of the (remote) object.
ii. Client Proxy (stub) marshals the invocation into messages and then passes it to the server
through network.
iii. Skeleton (server stub) unmarshals incoming message back to invocation and then passes it to
the object through the object’s interface.

4
iv. The object processes the incoming invocation by calling the right method to work on the
input data.
COMMUNICATION SYSTEMS
Problems with RPCs and RMIs
For RPC and RMI, we always assume the server side is executing at the time a client request is
issued. The interprocess will not happen if the server side is down. In any cases, after a request
is issued, the client side will be blocked until the result or an acknowledgement from the server
side is received. It is not efficient!

READ ON ‘Message oriented middleware’

You might also like