Different Approaches to Distributed Computation - Slide Notes | CMSC 433, Study notes of Programming Languages

Material Type: Notes; Professor: Sussman; Class: PROG LANG TECH & PDGMS; Subject: Computer Science; University: University of Maryland; Term: Spring 2002;

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-akh
koofers-user-akh 🇺🇸

9 documents

1 / 5

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CMSC 433, Alan Sussman, U. Maryland (via
Bill Pugh) 1
CMSC433, Spring 2002
Programming Language
Technology and Paradigms
Distributed Computing & RMI
Alan Sussman
March 14, 2002
CMSC 433, Spring 2002 -Alan Sussman 2
Administrivia
Commentary for project 2 due next Wed.
Project 4 posted
distributed computing with RMI
Read Ch. 15, pages 973-979, in Eckel
Readings web page also has additional
distributed computing reading
Return and talk about exam Tuesday
CMSC 433, Spring 2002 -Alan Sussman 3
Last time -Distributed computing
Issues
addressing objects
latency
partial failure
concurrency
Robustness and performance requirements call for
a non-uniform view of distributed objects
plan for failure
cope with latency
CMSC 433, Spring 2002 -Alan Sussman 4
Latency
Making a call to an object on a remote
machine is much more expensive than a
local call
several orders of magnitude
Leading to overall system performance
problems if there are “too many” remote
calls
RMI
CMSC 433, Spring 2002 -Alan Sussman 6
Different Approaches to
Distributed Computation
High-performance, parallel scientific apps
Connecting via sockets
custom protocols for each application
RPC/DCOM/CORBA/RMI
make what looks like a normal function call
function is actually invoked on another machine
Arguments are marshalled for transport
return value is marshalled as well
pf3
pf4
pf5

Partial preview of the text

Download Different Approaches to Distributed Computation - Slide Notes | CMSC 433 and more Study notes Programming Languages in PDF only on Docsity!

CMSC 433, Alan Sussman, U. Maryland (via

CMSC433, Spring 2002

Programming Language

Technology and Paradigms

Distributed Computing & RMI

Alan Sussman

March 14, 2002

CMSC 433, Spring 2002 - Alan Sussman 2

Administrivia

• Commentary for project 2 due next Wed.

• Project 4 posted

  • distributed computing with RMI

• Read Ch. 15, pages 973-979, in Eckel

  • Readings web page also has additional

distributed computing reading

• Return and talk about exam Tuesday

CMSC 433, Spring 2002 - Alan Sussman 3

Last time - Distributed computing

  • Issues
    • addressing objects
    • latency
    • partial failure
    • concurrency
  • Robustness and performance requirements call for

a non-uniform view of distributed objects

  • plan for failure
  • cope with latency

CMSC 433, Spring 2002 - Alan Sussman 4

Latency

• Making a call to an object on a remote

machine is much more expensive than a

local call

  • several orders of magnitude

• Leading to overall system performance

problems if there are “too many” remote

calls

RMI

CMSC 433, Spring 2002 - Alan Sussman 6

Different Approaches to

Distributed Computation

• High-performance, parallel scientific apps

• Connecting via sockets

  • custom protocols for each application

• RPC/DCOM/CORBA/RMI

  • make what looks like a normal function call
  • function is actually invoked on another machine
  • Arguments are marshalled for transport
  • return value is marshalled as well

CMSC 433, Alan Sussman, U. Maryland (via

CMSC 433, Spring 2002 - Alan Sussman 7

Remote Method Invocation

• Easy way to get distributed computation

• Have stub for remote object

  • calls to stub get translated into network call

• Arguments and return values can be passed

over network

CMSC 433, Spring 2002 - Alan Sussman 8

Remote Objects and Interfaces

• Remote Objects are those that can be

referenced remotely

  • extend java.rmi.UnicastRemoteObject
  • constructor throws java.rmi.RemoteException

• Remote interfaces describe services that can

be provided remotely

  • extend java.rmi.Remote interface
  • all methods throw java.rmi.RemoteException

CMSC 433, Spring 2002 - Alan Sussman 9

RMIC - RMI Compiler

• Generates stub code for a class

  • For 1.1, also generates skeleton class
  • skeleton not needed for 1.2+

• Generates stubs for all methods declared in

remote interfaces

  • other methods don’t get a stub

CMSC 433, Spring 2002 - Alan Sussman 10

Passing arguments

• Can pass arbitrary values as arguments

• Can return arbitrary values as results

• To pass a value, it must implement either

  • Serializable , or
  • Remote

• Passing the same Serializable object in

different calls

  • will materialize different objects at receiver

CMSC 433, Spring 2002 - Alan Sussman 11

Downloading code

• When you pass a reference to a remote class

  • receiver (the method being called) needs stub

class code (class file generated by rmic )

• When you pass a ref to serializable class

  • receiver needs class (the class file from javac )

• References to remote and serializable

classes annotated with RMI codebase

  • where code can be loaded from

CMSC 433, Spring 2002 - Alan Sussman 12

SecurityManager

• Must install some Security Manager to

allow download of classes from RMI

codebase

• Can use RMISecurityManager

System.setSecurityManager(new

RMISecurityManager());

• Modify policy file to grant permissions

  • example of that will be on Lectures web page

CMSC 433, Alan Sussman, U. Maryland (via

CMSC 433, Spring 2002 - Alan Sussman 19

RMI Registry on Server host

ServerImpl

Naming.rebind(“ ChatServer”, s);

Hosted Remote Objects

RMIRegistry

ChatServer

ServerImpl Stub

CMSC 433, Spring 2002 - Alan Sussman 20

Client creation on Client host

ClientImpl

Client c = new ClientImpl();

Hosted Remote Objects

c

CMSC 433, Spring 2002 - Alan Sussman 21

Server Lookup on Client host

ClientImpl

Server s = (Server) Naming.lookup(“//host/ ChatServer”);

Hosted Remote Objects

c

s

ServerImpl Stub

Hosted Remote Objects

ServerImpl CMSC 433, Spring 2002 - Alan Sussman 22

Invoke message on Server from Client host

prepare call on client

ClientImpl

Connection conn = s.logon(“Alan”, c);

Hosted Remote Objects

c

s

ServerImpl Stub

Marshalled arguments Serialized String “Alan” Serialized Stub for c

target

method: logon

CMSC 433, Spring 2002 - Alan Sussman 23

Unmarshalling arguments

on Server host

“Alan”

ClientImpl Stub

ServerImpl

Marshalled arguments Serialized String “Alan” Serialized Stub for c

target

method: logon logon

CMSC 433, Spring 2002 - Alan Sussman 24

Execution on Server host

“Alan”

ClientImpl Stub

ServerImpl

Hosted Remote Objects

name

client

conn

Connection Impl

CMSC 433, Alan Sussman, U. Maryland (via

CMSC 433, Spring 2002 - Alan Sussman 25

Marshalling return value on

Server host

“Alan”

ClientImpl Stub

ServerImpl

Hosted Remote Objects

Connection Impl

Marshalled return value:

Serialized Stub for conn

conn

CMSC 433, Spring 2002 - Alan Sussman 26

Unmarshalling return value on Client host

ClientImpl

Hosted Remote Objects

c

s

ServerImpl Stub

Marshalled return value Serialized Stub for conn

ConnImpl Stub

conn