Docsity

Slides on Remote Invocation and Objects | CS 5523, Study notes of Operating Systems

Toggle sidebar
bg1
1
CS 5523 Lecture 17:
Remote invocation and objects
❚Approaches for distributed communication
❚Interfaces
❚Objects
❚Java remote invocation (RMI)
❚An example application
❚The registry
Programming models for distributed applications:
❚Remote procedure call – client calls the procedure in a server
program that is running in a different process
❚Remote method invocation (RMI) – an object in one process can
invoke methods of objects in another process
❚Event notification – objects receive notification of events at other
objects for which they have registered
These mechanism must be location-transparent.
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Slides on Remote Invocation and Objects | CS 5523 and more Study notes Operating Systems in PDF only on Docsity!

CS 5523 Lecture 17:

Remote invocation and objects

❚ Approaches for distributed communication ❚ Interfaces ❚ Objects ❚ Java remote invocation (RMI) ❚ An example application ❚ The registry

Programming models for distributed applications:

❚ Remote procedure call – client calls the procedure in a server program that is running in a different process

❚ Remote method invocation (RMI) – an object in one process can invoke methods of objects in another process

❚ Event notification – objects receive notification of events at other objects for which they have registered

These mechanism must be location-transparent.

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 5. Middleware layers

Applications

Middleware Request reply protocol layers External data representation Operating System

RMI, RPC and events

Interfaces:

❚ Specify procedures (methods) and variables that can be accessed in a module

❚ No information other than that specified by the interface can be communicated.

❚ Do not specify an implementation

❚ Types of interfaces:

❙ Service interface (RPC) ❙ Remote interface (RMI)

Systems that support RMI:

❚ CORBA – Common Object Request Broker Architecture

❚ Java RMI

❚ Microsoft’s Distributed Common Object Model (DCOM, now COM)

Review of objects:

❚ An object encapsulates both data and methods

❚ Objects are accessed via object references

❚ Interfaces – provide definitions of signature of a set of methods

❚ Actions are performed in OO by having objects invoke methods of other objects.

❚ Invocation can cause:

❙ the state of the receiver to be changed (modifier methods) ❙ additional invocations of methods on other objects

❚ Exceptions are thrown when an error occurs. If object doesn’t “catch” the exception, the exception is delivered to caller (similar to signals, but at the programming language level)

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 5. Remote and local method invocations

invocation invocation

remote invocationremote

local local local

invocation invocation

A B

C

D

E F

Remote object reference:

❚ An object must have the remote object reference of an object in order to do remote invocation of an object

❚ Remote object references may be passed as input arguments or returned as output arguments.

A simple example (handout):

❚ Server runs on remote machine.

❚ Remote classes are available on another host with a web server.

❚ Server registers with a binder on its machine, indicating its service and where to find the code.

❚ Client contacts the binder on the remote machine.

❚ The binder tells the client where to find the stub class and returns a remote object reference

❚ The client downloads the stub class

❚ The client invokes methods in the remote object

See http://vip.cs.utsa.edu/classes/cs5523s2001/lectures/JavaRMI/simpleHello.html

web server host

RMI client

web server

server host

RMIregistry

RMI server

  1. register object
  2. lookup object 3, return remote object reference
  3. request stub class
  4. return stub class
  5. remote invocation
  6. return result

client host

Architecture of a basic Java RMI call:

Naming conventions for RMI classes:

❚ Xxxxx (no suffix) – a remote interface

❚ XxxxxImpl – a servant class implementing interface

❚ XxxxxServer – a server program that creates servant objects

❚ XxxxxClient – a client program that calls remote methods of Xxxxx

❚ XxxxxImpl_Stub – a stub class generated for XxxxxImpl by rmic

❚ XxxxxImpl_Skel – a skeleton class generated for XxxxxImpl by rmic (no longer needed in Java 2)

Remote object reference:

❚ An object must have the remote object reference of an object in order to do remote invocation of an object

❚ Remote object references may be passed as input arguments or returned as output arguments.

❚ Parameters of a method in Java are input parameters

❚ Returned result of a method in Java is the output parameter

❚ Objects are serialized to be passed as parameters

❚ When a remote object reference is returned, it can be used to invoke remote methods

❚ Non-remote serializable objects are copied by value

Instructor’s Guide for Coulouris, Dollimore and Kindberg© Addison-Wesley Publishers 2000 Distributed Systems: Concepts and Design Edn. 3

Figure 5. Classes supporting Java RMI

RemoteServer

UnicastRemoteObject

Activatable

RemoteObject

For next time:

❚ Read CDK 5.1, 5.2 and 5.