1 / 30

Communication between distributed objects

Communication between distributed objects. 姓名 : 邱 秀 純 學號 :M9129017. Applications. RMI, RPC and events. Middleware. Request reply protocol. layers. External data representation. Operating System. Figure 5.1 Middleware layers. Middleware

Download Presentation

Communication between distributed objects

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Communication between distributed objects 姓名: 邱 秀 純 學號:M9129017

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

  3. Middleware • Software that provides a programming model above the basic building blocks of processes and message passing is called middleware • Location transparency and independence from the details of communication protocols ,OS and computer hardware • Use of several programming languages

  4. interfaces • Control the possible interactions between modules, an explicit interface is defined for each module. • CORBA IDL interfaces can specify attributes • parameter-passing mechanisms • Input • output • Pointer

  5. Service interfaces: • Is used to refer to the specification of the procedures offered by a sever , defining the types of the input and output arguments of each of the procedures • Remote interfaces: • Specifies the methods of an object that are available for invocation by object in other processes ,defining the types of the input and output arguments of each of them. The big difference can pass object as argument and results of methods

  6. IDL • Designed to allow objects implemented in different languages to invoke one another

  7. Figure 5.2CORBA 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(); };

  8. Object model • Object references • Interfaces • Action • Exceptions • Garage collection

  9. Distributed objects • A program is partitioned into separate parts ,each of which is associated with an object • advantage • Avoid conflicting access • Object may be accessed via RMI • Object are accessed only via their method gives another advantage for heterogeneous systems in that different data formats may be used at different sites

  10. Distributed object model • Extension to the object model to make it applicable to distributed object • Method invocation: • Method invocation between objects in the same process are local method invocation • Method invocation between objects in differences processes are Remote method invocation

  11. local C remote E local invocation invocation remote invocation invocation F B local A invocation D Figure 5.3Remote and local method invocations

  12. Two fundamental concepts: • Remote object reference: • Other objects can invoke the methods of a remote object if they have access to its remote object reference • Is an identifier that can be used throughout a distributed system to refer to a particular unique remote object • Remote interface: • Every remote object has a remote interface that specifies which of its method can be invoked remotely • An interface is allowed to extend one or more other interface

  13. remote object Data remote interface m4 { m1 implementation m5 m2 m6 of methods m3 Figure 5.4A remote object and its remote interface

  14. Invocation Fault tolerance measures semantics Retransmit request Duplicate Re-execute procedure message filtering or retransmit reply No Not applicable Not applicable Maybe Yes No Re-execute procedure At-least-once Yes Yes Retransmit reply At-most-once Figure 5.5Invocation semantics Exactly once: local invocations

  15. Maybe& At-least-once & At-most-once Maybe • The invoker cannot tell whether a remote method has been executed once or not at all • None of the fault tolerance measure is applied ,there are two failure: • Omission failures • Crash failures At-least-once • At-least-once have two failure: • Crash failures • Arbitrary failures

  16. server client remote skeleton object A proxy for B object B & dispatcher Request for B’s class Reply Remote reference Communication Communication Remote module reference module module module Figure 5.6The role of proxy and skeleton in remote method invocation

  17. Communication module • Remote reference module is responsible for (1)translating between local and remote object reference (2)creating remote object reference • remote object table :record the correspondence between local object references in that process and emoted object references • Table includes: • An entry for all the remote objects held by the process • An entry for each local proxy

  18. 何 謂 RMI RMI : Remote Method Invocation(遠端方法呼叫) • 功能:讓客戶端執行的程式去呼叫遠端伺服器所提供的方法   • 原理:與SUN 的RPC的功能類似,它將參數資料匯集(marshalling)串列化(serialization)後傳送到另一台主機上,並利用該主機所提供的函式來處理這些資料,然後再將所得到結果串列化後傳送回來。可以說是 Java 版的 RPC。   • 不同:RPC利用UDP協定,RMI利用TCP協定

  19. 架構圖

  20. Stub:客戶端的代理人,當客戶端要呼叫遠端的方法時,將它的參數傳遞出去,並不會有直接到遠端主機,而是先到stub,stub負責找到提供方法的遠端主機位址,然後再將參數串列化 • Skeleton:伺服端的代理人,當它接收列串列化的資料後,先將資料反串列化組合回來,接著看客戶需要用什麼方法處理,在伺服端找到該方法,經過該方法處理後,便得到一個回傳值。同理Skeleton也須將回傳值做串列化,傳給Stub

  21. Remote reference layer: • 負責處理遠端物件的 呼叫語意 (semantic of invocation)  • 決定遠端物件是否被複製 (replicated) 。 • 如果遠端物件被複製,則負責確保每個副本所收到的呼叫要求是 atomic。 • 負責處理伺服器的參考語意 (reference semantic for servers) • 遠端物件可以在某個 Java 虛擬機器(VM) 內一直存在,等著被呼叫 。 • 或是在有其他物件呼叫它時才真的去建立遠端物件。 • Transport layer: • 負責建立每對虛擬機器間唯一的一條通道 (channel)。 • 每當有資料需要傳輸時,會在通道內建立連線 (connection)。

  22. The RMI software • Proxy: make remote method invocation transparent to clients by behaving like a local object to the invoker • Dispatcher: A server has one dispatcher and skeleton for each class representing a remote object • Skeleton :The class of a remote object has a skeleton ,which implement the methods in the remote interface

  23. Interface complier automatically generation of the classes for proxies ,dispatchers and Skeleton • Server and client Program • server program contain the classes for the dispatchers and skeletons • Client program :the classes of the proxies • The binder : in the distributed system is a separate service that maintain a table containing mapping from textual name to remote object references • Server threads: to avoid the execution of one remote invocation delaying the execution of another • Activation of remote objects • Persistent object stores • Object location

  24. Distributed garbage collection • Aim • distributed garbage collector ensure that if a local or remote reference to an object is still held anywhere in a set of distributed object ,then the object itself will continue to exist ,but as soon as no object any a reference to it ,then object will be collected and the memory it uses recovered • Java distributed garbage collection algorithm(P182)

  25. client process server process Request Reply client stub server stub procedure procedure service client Communication Communication program procedure dispatcher module module Figure 5.7Role of client and server stub procedures in RPC

  26. Events and notifications • publish-subscribe paradigm • Publish: an object that generates events publish the type of events • Subscribe to the types of events that are of interest to them • Distributed event-base system have two main characteristics • Heterogeneous • asynchronous

  27. External Dealer’s computer Dealer’s computer source Dealer Notification Notification Dealer Information Notification Notification provider Notification Notification Notification Dealer’s computer Dealer’s computer Notification Information provider Notification Notification Dealer Dealer External source Figure 5.9Dealing room system

  28. Event service subscriber object of interest 1. notification object of interest observer subscriber 2. notification notification object of interest observer subscriber 3. notification Figure 5.10Architecture for distributed event notification

  29. Roles for Observers • Forwarding • Filtering of notifications • Patterns of events • Notification mailbox

  30. Jini • The main object involved in the Jini distributed event distributed event specification • Event generator • Remote event listener • Remote events • Third-party events

More Related