Download presentation
1
Chapter 5: Distributed objects and remote invocation
From Coulouris, Dollimore and Kindberg Distributed Systems: Concepts and Design Edition 3, © Addison-Wesley 2001 Presentation based on slides by Coulouris et al; modified by Jens B Jorgensen and Jonas Thomsen, University of Aarhus
2
Distributed objects – middleware
Applications Middleware layers Request reply protocol External data representation Operating System RMI, RPC and events
3
Distributed objects – interfaces
Programs = communicating modules Module interface specifies: Available procedures (and variables). Parameters (input, output, both). Hiding of implementation details. Allows implementation to be replaced without client knowledge Ensures encapsulation (only referring to object data through methods) Service interfaces (RPC), remote interfaces (RMI). Interface Definition Language: A notation for defining interfaces.
4
Distributed objects – 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(); };
5
Distributed objects – basic model
invocation remote local A B C D E F Local method invocation Remote method invocation Remote object Remote object reference
6
Distributed objects – remote objects and remote interfaces
Data implementation object { of methods
7
Remote method invocation – invocation semantics
Local invocations executed exactly once. RMI invocation semantics: Maybe (operations without answer). At-least once (good for idempotent operations). At-most once (used in Java RMI and CORBA). RMI invocation semantics ensured by: Maybe: No ensuring At-least once: Retries At-most once: Retries, history of replies
8
Remote method invocation – invocation semantics techniques
Fault tolerance measures Invocation semantics Retransmit request message Duplicate filtering Re-execute procedure or retransmit reply No Yes Not applicable Retransmit reply At-most-once At-least-once Maybe
9
Remote method invocation – architectural model
object A object B skeleton Request proxy for B Reply Communication Remote Remote reference module reference module for B’s class & dispatcher remote client server
10
Remote method invocation – communication module
Request Server Client doOperation (wait) (continuation) Reply message getRequest execute method select object sendReply messageType requestId objectReference methodId arguments int (0=Request, 1= Reply) int RemoteObjectRef int or Method array of bytes
11
Remote method invocation – remote reference module
Translates between local and remote object references. Has a remote object table with entries for all remote objects held by the process, and a record for each local proxy. Creates remote object references.
12
Remote method invocation – RMI software
Layer between application-level objects and the communication and remote reference modules. Consists of: Proxy. Dispatcher. Skeleton. Classes for RMI software can be generated automatically by an interface compiler.
13
Remote method invocation – proxy
Makes remote method invocation transparent to clients. Behaves like a local object to the invoker. Implements the methods in the remote interface of the remote object it represents. Does not execute invocation, but forwards request to remote object. Marshals a reference to the target object, its own methodId and its arguments into a request message; sends the request message to the target (via communication module); awaits the reply message; unmarshals the reply; returns the result to the invoker;
14
Remote method invocation – dispatcher and skeleton
Receives request message from communication module; Uses methodId to select the appropriate method in the skeleton; Passes on the request; Skeleton: Unmarshals the arguments in the request message; Invokes the corresponding method in the remote object; Waits for result; Marshals result; Sends reply to sender’s proxy (via communication module);
15
Remote method invocation – location and activation
Binder Maps textual names to remote object references. Location service Maps remote object references to remote objects Active/passive objects Active object are available in memory Passive objects has been stored on disk and removed from memory Clients only see remote object. Activation is transparent.
16
Remote method invocation – garbage collection
Local: Objects are freed when no more references exist Distributed: Reference counting: When a proxy is created, client sends addRef to server When a proxy is freed, client sends removeRef to server When remote objects holders is empty local garbage collection disposes it If a client crashes, a removeRef is missing remote object not being freed; solution… Leases Clients must renew remote object references periodically. If not renewed, remote object might be freed. Used in Java RMI.
17
Events and notifications – basics
One object can react to a change occurring in another object. Publish-subscribe communication pattern. Applicable in heterogeneous environments. Asynchronous: Publishers and subscribers are decoupled.
18
Events and notifications – dealing room system
Dealer’s computer Information provider Dealer External source Notification
19
Events and notifications – delivery semantics
IP Multicast suitable in applications where a missing update is acceptable; online games. Reliable Multicast All clients must receive all messages; dealing room example. Real-time Reliable Multicast Nuclear power plant events.
20
Events and notifications – observer roles
Forwarding Object of interest sends all notifications to the forwarding observer, which handles communication with subscribers. Filtering of notifications To limit the number of event an subscriber receives, a filtering observer might filter events on behalf of the subscriber. Patterns of events Subscribers can specify patterns of interest. An observer does the pattern matching on behalf of the object of interest. Notification mailboxes When a subscriber is unable to receive notifications it can use a notification mailbox, which stores notification until it is ready for receiving them.
21
Remote method invocation (RMI). Events and notifications.
Summary Distributed objects. Remote method invocation (RMI). Events and notifications.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.