You are on page 1of 24

Distributed Systems

Remote Procedure Call &


Remote Method Invocation

1
Middleware Layers

Applications

RMI, RPC and events


Middleware
Request reply protocol layers
External data representation

Operating System

Distributed Systems ccsejc, November 2003 2


Remote Procedure Call (RPC)
Why RPC?
 Sockets are considered low-level
 RPCs offer a higher-level form of
communication
Client makes procedure call to “remote”
server using ordinary procedure call
mechanisms

Distributed Systems ccsejc, November 2003 3


Client and Server

Distributed Systems ccsejc, November 2003 4


Binding in RPC

Distributed Systems ccsejc, November 2003 5


Basic Concept of RPC

Distributed Systems ccsejc, November 2003 6


Steps for RPC

Distributed Systems ccsejc, November 2003 7


Issues in RPC
Cannot pass pointers
Weakly typed languages
Not always possible to determine
parameter types
Cannot use global variables

Distributed Systems ccsejc, November 2003 8


Remote Method Invocation

Java’s version of RPC


A thread may invoke a method on a
remote object
An object is considered “remote” if it
resides in a separate Java Virtual
Machine.

Distributed Systems ccsejc, November 2003 9


Remote Method Invocation

Distributed Systems ccsejc, November 2003 10


RPC versus RMI
RPC’s support procedural programming style
RMI supports object-oriented programming
style

Parameters to RPCs are ordinary data


structures
Parameters to RMI are objects

Distributed Systems ccsejc, November 2003 11


Object Model
Object
 Data
 Methods
Encapsulation
Object Reference
 unique identifier of object
 should not be reused

Distributed Systems ccsejc, November 2003 12


Object Model
Method Invocation
 object reference + method name
Interface
 types of arguments
 return values
 exceptions

Distributed Systems ccsejc, November 2003 13


Distributed Objects
Adopts client/server architecture
May be replicated
May be migrated
May be accessed concurrently

Distributed Systems ccsejc, November 2003 14


Distributed Objects

remote local C
invocation invocation local E
invocation remote
invocation F
B
A local
invocation D

Distributed Systems ccsejc, November 2003 15


Remote Object and Interface
Remote Object Reference
 unique
 can be used as arguments and results
Remote Interface
 no constructors
 extend remote interface

Distributed Systems ccsejc, November 2003 16


Remote Object and Interface

remote object

Data
remote
interface
m1 m4

{
implementation
m5
m2
of methods m6
m3

Distributed Systems ccsejc, November 2003 17


RMI Implementation

client server
remote
object A proxy for B skeleton
object B
Request & dispatcher
for B’s class

Reply

Remote Communication Communication Remote reference


reference module module module module

Distributed Systems ccsejc, November 2003 18


RMI Implementation
Classes for proxies, skeleton,
dispatchers
Initialization Section (Server)
Factory Methods
Binder

Distributed Systems ccsejc, November 2003 19


Events and Notifications
Events
 state change
Notification
 allows object to respond to state changes

Distributed Systems ccsejc, November 2003 20


Distributed Event-Based System
Publish-Subscribe Paradigm
 Publish
 type of events available (notification)
 Subscribe
 registering interest

Heterogeneous
Asynchronous

Distributed Systems ccsejc, November 2003 21


Dealing Room System
Dealer’s computer External Dealer’s computer
source

Dealer Notification Notification Dealer

Notification Information
provider Notification

Notification
Notification
Notification
Dealer’s computer Dealer’s computer
Notification
Information
provider
Notification
Dealer Notification
Dealer
External
source

Distributed Systems ccsejc, November 2003 22


Distributed Event Notification
Object of Interest
Event
Notification
Subscriber
Observer Objects (Event Monitor)
Publisher

Distributed Systems ccsejc, November 2003 23


Distributed Event Notification
Event service
object of interest subscriber

1. notification

object of interest observer subscriber


2. notification notification

object of interest observer subscriber

3. notification

Distributed Systems ccsejc, November 2003 24

You might also like