RMI Chapter 5 Nematulllah and Fariba
RMI Chapter 5 Nematulllah and Fariba
RMI Chapter 5 Nematulllah and Fariba
CHAPTER(5)
• RPC is a inter process communication which allows calling a function in another process
residing in local or remote machine, it invoke a function
• RPC is a protocol that one program can use to request a service from a program located in
another computer on a network without having to understand the network details. A
procedural call is also known as a
function call
BASIC RPC OPERATION
RPC OPERATION
ELEMENTS OF RPC MECHANISM
IMPLEMENTATION
• Client
• Client Stub
• RPC runtime
• Server stub
• Server
RPC
EXECUTION
CONT…
• Client procedural calls client stub in normal way
• Client stub builds message ,calls local
• Client ‘s OS sends message to remote OS
• Remote OS gives message to server stub
• Server stub unpacks parameters, calls server
• Server does work, returns result to the stub
• Server stub packs it in message, calls local OS
• Server ‘s OS send message to client’s OS
• Server ‘s OS gives message to client stub
• Stub un packs result ,return to client
RPC IMPLEMENTATION
RPC CALL/REQUEST
MESSAGE
RPC REPLY MESSAGE
WHAT IS RMI ?
1) Application layer
2) Proxy layer
4) Transport layer
CONT…
Application layer :
• Responsible for running client an applications here client application invoke
methods defined server application
• When client invokes a method then request is passed to proxy
Proxy layer :
• Responsible for creating client stub at side by packing the request msgs sent by client
process
• Also responsible for creating skeleton by packing response msgs sent by server
• Once stub and skeleton are created they are passed to RRL
CONT…
Remote Reference layer (RRL)
• Checks semantic and remote reference used by client process using remote reference
protocol
• Finally RRL transmits msgs and data to RMI transport layer
Transport Layer :
• Responsible for establishing and maintaining stream oriented connection between client and
server
• Also responsible for managing send/receive of request/reply msgs between client and server
MARSHALLING AND UNMARSHALING:
• During communication between two machines through RPC or RMI, parameters are packed
into a message and then sent over the network. This packing of parameters into a message is
called marshalling. On the other side these packed parameters are unpacked from the
message which is called unmarshalling.
WHAT IS STUB AND SKELETON???
• RMI Advantages:
Java RMI model is simple and easy to use.
Very reliable distributed applications.
Easier to use and setup than CORBA.
RDMI enables dynamic invocation.
• RMI disadvantages:
java only.
Limited functionality because of security restrictions.
No support for legacy systems.
DISTRIBUTED GARBAGE
COLLECTION
• RMI provides a distributed garbage collector that deletes remote objects no longer
referenced by a client
• Uses a reference-counting algorithm to keep track of live references in each Virtual Machine
• RMI keeps track of VM identifiers, so objects are collected when no local or remote
references to them
on
e n ti
A tt
ic e
r N
y ou
o r
s F
k
h an
T