distributed systems - rpc and rmi

Post on 18-Nov-2014

2.883 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

1

Distributed Systems

Remote Procedure Call & Remote Method Invocation

Distributed Systems ccsejc, November 2003 2

Middleware Layers

Applications

Middlewarelayers Request reply protocol

External data representation

Operating System

RMI, RPC and events

Distributed Systems ccsejc, November 2003 3

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 4

Client and Server

Distributed Systems ccsejc, November 2003 5

Binding in RPC

Distributed Systems ccsejc, November 2003 6

Basic Concept of RPC

Distributed Systems ccsejc, November 2003 7

Steps for RPC

Distributed Systems ccsejc, November 2003 8

Issues in RPCCannot pass pointersWeakly typed languagesNot always possible to determine parameter typesCannot use global variables

Distributed Systems ccsejc, November 2003 9

Remote Method Invocation

Java’s version of RPCA thread may invoke a method on a remote objectAn object is considered “remote” if it resides in a separate Java Virtual Machine.

Distributed Systems ccsejc, November 2003 10

Remote Method Invocation

Distributed Systems ccsejc, November 2003 11

RPC versus RMI

RPC’s support procedural programming styleRMI supports object-oriented programming style

Parameters to RPCs are ordinary data structuresParameters to RMI are objects

Distributed Systems ccsejc, November 2003 12

Object Model

Object Data Methods

EncapsulationObject Reference unique identifier of object should not be reused

Distributed Systems ccsejc, November 2003 13

Object Model

Method Invocation object reference + method name

Interface types of arguments return values exceptions

Distributed Systems ccsejc, November 2003 14

Distributed Objects

Adopts client/server architectureMay be replicatedMay be migratedMay be accessed concurrently

Distributed Systems ccsejc, November 2003 15

Distributed Objects

invocation invocationremote

invocationremote

locallocal

local

invocation

invocationA B

C

D

E

F

Distributed Systems ccsejc, November 2003 16

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 17

Remote Object and Interface

interface

remote

m1m2m3

m4m5m6

Data

implementation

remote object

{ of methods

Distributed Systems ccsejc, November 2003 18

RMI Implementation

object A object Bskeleton

Requestproxy for B

Reply

CommunicationRemote Remote referenceCommunication

module modulereference module module

for B’s class& dispatcher

remoteclient server

Distributed Systems ccsejc, November 2003 19

RMI Implementation

Classes for proxies, skeleton, dispatchersInitialization Section (Server)Factory MethodsBinder

Distributed Systems ccsejc, November 2003 20

Events and Notifications

Events state change

Notification allows object to respond to state

changes

Distributed Systems ccsejc, November 2003 21

Distributed Event-Based System

Publish-Subscribe Paradigm Publish

type of events available (notification) Subscribe

registering interest

HeterogeneousAsynchronous

Distributed Systems ccsejc, November 2003 22

Dealing Room SystemDealer’s computer

Informationprovider

Dealer

Externalsource

Externalsource

Informationprovider

Dealer

Dealer

Dealer

Notification

Notification

Notification

Notification

NotificationNotification

Notification

Notification

Dealer’s computer

Dealer’s computerDealer’s computer

NotificationNotification

Distributed Systems ccsejc, November 2003 23

Distributed Event Notification

Object of InterestEventNotificationSubscriberObserver Objects (Event Monitor)Publisher

Distributed Systems ccsejc, November 2003 24

Distributed Event Notification

subscriberobserverobject of interest

Event service

object of interest

object of interest observer

subscriber

subscriber

3.

1.

2. notification

notification

notification

notification

top related