Distributed Systems Lecture 10: Distributed Objects & Event - - PowerPoint PPT Presentation

distributed systems
SMART_READER_LITE
LIVE PREVIEW

Distributed Systems Lecture 10: Distributed Objects & Event - - PowerPoint PPT Presentation

Distributed Systems Lecture 10: Distributed Objects & Event Notification 95-702 OCT 1 Master of Information System Management Middleware layers Applications RMI, RPC and events Middleware Request reply protocol layers External data


slide-1
SLIDE 1

95-702 OCT

1

Master of Information System Management

Distributed Systems

Lecture 10: Distributed Objects & Event Notification

slide-2
SLIDE 2

95-702 OCT

2

Master of Information System Management

Middleware layers

Applications Middleware layers Request reply protocol External data representation Operating System RMI, RPC and events

slide-3
SLIDE 3

95-702 OCT

3

Master of Information System Management

Traditional Interfaces

  • Interfaces promote modularity.
  • Recall the use of c header files.
  • One module may access another

module without concern over implementation details.

  • Method signatures are specified.
  • The compiler need only consider

signatures when compiling the caller.

slide-4
SLIDE 4

95-702 OCT

4

Master of Information System Management

Interface Definition Language

  • Definition: An interface definition

language (IDL) provides a notation for defining interfaces in which each

  • f the parameters of a method may

be described as for input or output in addition to having its type specified.

  • These may be used to allow objects

written in different languages to invoke one another.

slide-5
SLIDE 5

95-702 OCT

5

Master of Information System Management

Interface Definition Language

  • A language independent IDL can be used bridge

the gap between programming languages.

  • Examples include:
  • Corba IDL (Object-oriented syntax)
  • OSF’s Distributed Computing Environment

DCE (C like syntax)

  • DCOM IDL based on OSF’s DCE and used

by Microsoft’s DCOM

  • Sun XDR (An IDL for RPC)
  • Web Services WSDL
  • In the case of Web Services, how is WSDL different

from XSDL?

slide-6
SLIDE 6

95-702 OCT

6

Master of Information System Management

CORBA IDL example

// In file Person.idl struct Person { string name; string place; long year; } ; interface PersonList { readonly attribute string listname; void addPerson(in Person p) ; void getPerson(in string name, out Person p); long number(); };

How does this compare with WSDL?

slide-7
SLIDE 7

95-702 OCT

7

Master of Information System Management

File interface in Sun XDR (Originally External Data Representation but now an IDL) for RPC

const MAX = 1000; typedef int FileIdentifier; typedef int FilePointer; typedef int Length; struct Data { int length; char buffer[MAX]; }; struct writeargs { FileIdentifier f; FilePointer position; Data data; }; struct readargs { FileIdentifier f; FilePointer position; Length length; }; program FILEREADWRITE { version VERSION { void WRITE(writeargs)=1; // procedure Data READ(readargs)=2; // numbers }=2; // version number } = 9999; // program number // numbers passed in request message // rpcgen is the interface compiler

slide-8
SLIDE 8

95-702 OCT

8

Master of Information System Management

Traditional Object Model

  • Each object is a set of data and a set of methods.
  • Object references are assigned to variables.
  • Interfaces define an object’s methods.
  • Actions are initiated by invoking methods.
  • Exceptions may be thrown for unexpected or illegal

conditions.

  • Garbage collection may be handled by the developer

(C++) or by the runtime (.NET and Java)

slide-9
SLIDE 9

95-702 OCT

9

Master of Information System Management

Distributed Object Model

  • Having client and server objects in different processes

enforces encapsulation. You must call a method to change its state.

  • Methods may be synchronized to protect against

conflicting access by multiple clients.

  • Objects are accessed remotely (by message passing) or
  • bjects are copied to the local machine (if the object’s

class is available locally) and used locally.

  • Remote object references are analogous to local ones

in that:

  • 1. The invoker uses the remote object reference to

identify the object and

  • 2. The remote object reference may be passed as an

argument to or return value from a local or remote method.

slide-10
SLIDE 10

95-702 OCT

10

Master of Information System Management

Remote and Local Method Invocations

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

slide-11
SLIDE 11

95-702 OCT

11

Master of Information System Management

A Remote Object and its Remote Interface

interface remote m1 m2 m3 m4 m5 m6 Data implementation remote

  • bject

{

  • f methods
slide-12
SLIDE 12

95-702 OCT

12

Master of Information System Management

RMI Design Issues

  • RMI Invocation Semantics

Local calls have Exactly Once semantics. Remote calls have Maybe, At Least Once

  • r at Most Once semantics. Different semantics

are due to the fault tolerance measures applied during the request reply protocol.

  • Level of Transparency

Remote calls should have a syntax that is close to local calls. But it should probably be clear to the programmer that a remote call is being made.

slide-13
SLIDE 13

95-702 OCT

13

Master of Information System Management

Invocation Semantics

Fault tolerance measures Invocation semantics Retransmit request message Duplicate filtering Re-execute procedure

  • r retransmit reply

No Yes Yes Not applicable No Yes Not applicable Re-execute procedure Retransmit reply (history) At-most-once At-least-once Maybe

Duplicate filtering means removing duplicate request at the server.

slide-14
SLIDE 14

95-702 OCT

14

Master of Information System Management

Invocation Semantics

  • Maybe semantics is useful only for

applications in which occasional failed invocations are acceptable.

  • At-Least-Once semantics is appropriate

for idempotent operations.

  • At-Most-Once semantics is the norm.
slide-15
SLIDE 15

95-702 OCT

15

Master of Information System Management

Generic RMI Modules

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

slide-16
SLIDE 16

95-702 OCT

16

Master of Information System Management

The Remote Reference Module

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

The remote reference module holds a table that records the correspondence between local object references in that process and remote object references (which are system wide).

slide-17
SLIDE 17

95-702 OCT

17

Master of Information System Management

The Communication Module

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

Coordinate to provide a specified invocation semantics. The communication module selects the dispatcher for the class of the object to be invoked, passing on the remote object’s local reference.

slide-18
SLIDE 18

95-702 OCT

18

Master of Information System Management

Proxies

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

The proxy makes the RMI transparent to the caller. It marshals and unmarshals

  • parameters. There is one proxy for each remote object. Proxies hold the remote
  • bject reference.
slide-19
SLIDE 19

95-702 OCT

19

Master of Information System Management

Dispatchers and Skeletons (1)

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

The server has one dispatcher and skeleton for each class representing a remote object. A request message with a methodID is passed from the communication module. The dispatcher calls the method in the skeleton passing the request message. The skeleton implements the remote object’s interface in much the same way that a proxy does. The remote reference module may be asked for the local location associated with the remote reference.

slide-20
SLIDE 20

95-702 OCT

20

Master of Information System Management

Dispatchers and Skeletons (2)

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

The communication module selects the dispatcher based upon the remote object

  • reference. The dispatcher selects the method to call in the skeleton. The skeleton

unmarshalls parameters and calls the method in the remote object.

slide-21
SLIDE 21

95-702 OCT

21

Master of Information System Management

Generic RMI Summary

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

RMI software - between application level objects and communication and remote reference modules

Proxy - makes RMI transparent to client. Class implements remote interface. Marshals requests and unmarshals

  • results. Forwards request.

Dispatcher - gets request from communication module and invokes method in skeleton (using methodID in message). Skeleton - implements methods in remote interface. Unmarshals requests and marshals results. Invokes method in remote object.

  • carries out Request-

reply protocol translates between local and remote object references and creates remote object

  • references. Uses remote object table
slide-22
SLIDE 22

95-702 OCT

22

Master of Information System Management

Binders

  • bject A
  • bject B

skeleton Request proxy for B Reply Communication Remote Remote reference Communication module module reference module module for B’s class & dispatcher remote client server

Java uses the rmiregistry CORBA uses the CORBA Naming Service

Binders allow an object to be named and registered.

slide-23
SLIDE 23

95-702 OCT

23

Master of Information System Management

Local Events and Notifications

  • Examples of the local event model:

(1) A keystroke causes an interrupt handler to execute, storing a key character in the keyboard buffer. (2) A mouse click causes an interrupt handler to call a registered listener to handle the mouse event.

slide-24
SLIDE 24

95-702 OCT

24

Master of Information System Management

Distributed Event Based System

  • Suppose a whiteboard server is willing

to make calls to all registered clients when the drawing is changed by any

  • ne client.
  • Clients may subscribe to this service

(register interest).

  • The whiteboard server publishes the

events that it will make available to clients.

  • This is the publish-subscribe paradigm
slide-25
SLIDE 25

95-702 OCT

25

Master of Information System Management

Two Characteristics of Distributed Event Based Systems

(1) Heterogeneous

  • - event generators publish the types of

events they offer

  • - other objects subscribe and provide

callable methods

  • - components that were not designed

to work together may interoperate

slide-26
SLIDE 26

95-702 OCT

26

Master of Information System Management

Two Characteristics of Distributed Event Based Systems

(2) Asynchronous

  • - Publishers and subscribers are

decoupled

  • - notifications of events are sent

asynchronously to all subscribers

slide-27
SLIDE 27

95-702 OCT

27

Master of Information System Management

Dealing room system

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

slide-28
SLIDE 28

95-702 OCT

28

Master of Information System Management

Architecture for distributed event notification

subscriber

  • bserver
  • bject of interest

Event service

  • bject of interest
  • bject of interest
  • bserver

subscriber subscriber 3. 1. 2. notification notification notification notification