24
1 Distributed Systems Remote Procedure Call & Remote Method Invocation

Distributed Systems - RPC and RMI

  • Upload
    kat5t

  • View
    2.883

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Distributed Systems - RPC and RMI

1

Distributed Systems

Remote Procedure Call & Remote Method Invocation

Page 2: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 2

Middleware Layers

Applications

Middlewarelayers Request reply protocol

External data representation

Operating System

RMI, RPC and events

Page 3: Distributed Systems - RPC and RMI

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

Page 4: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 4

Client and Server

Page 5: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 5

Binding in RPC

Page 6: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 6

Basic Concept of RPC

Page 7: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 7

Steps for RPC

Page 8: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 8

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

Page 9: Distributed Systems - RPC and RMI

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.

Page 10: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 10

Remote Method Invocation

Page 11: Distributed Systems - RPC and RMI

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

Page 12: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 12

Object Model

Object Data Methods

EncapsulationObject Reference unique identifier of object should not be reused

Page 13: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 13

Object Model

Method Invocation object reference + method name

Interface types of arguments return values exceptions

Page 14: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 14

Distributed Objects

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

Page 15: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 15

Distributed Objects

invocation invocationremote

invocationremote

locallocal

local

invocation

invocationA B

C

D

E

F

Page 16: Distributed Systems - RPC and RMI

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

Page 17: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 17

Remote Object and Interface

interface

remote

m1m2m3

m4m5m6

Data

implementation

remote object

{ of methods

Page 18: Distributed Systems - RPC and RMI

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

Page 19: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 19

RMI Implementation

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

Page 20: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 20

Events and Notifications

Events state change

Notification allows object to respond to state

changes

Page 21: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 21

Distributed Event-Based System

Publish-Subscribe Paradigm Publish

type of events available (notification) Subscribe

registering interest

HeterogeneousAsynchronous

Page 22: Distributed Systems - RPC and RMI

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

Page 23: Distributed Systems - RPC and RMI

Distributed Systems ccsejc, November 2003 23

Distributed Event Notification

Object of InterestEventNotificationSubscriberObserver Objects (Event Monitor)Publisher

Page 24: Distributed Systems - RPC and RMI

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