分布对象.ppt

上传人:本田雅阁 文档编号:3127711 上传时间:2019-07-14 格式:PPT 页数:70 大小:2.43MB
返回 下载 相关 举报
分布对象.ppt_第1页
第1页 / 共70页
分布对象.ppt_第2页
第2页 / 共70页
分布对象.ppt_第3页
第3页 / 共70页
分布对象.ppt_第4页
第4页 / 共70页
分布对象.ppt_第5页
第5页 / 共70页
点击查看更多>>
资源描述

《分布对象.ppt》由会员分享,可在线阅读,更多相关《分布对象.ppt(70页珍藏版)》请在三一文库上搜索。

1、分布对象(1),Distributed Objects,2019/7/14,Institute of Computer Software Nanjing University,1,摘要,背景 Why, What, How 一般框架 CORBA Java RMI,2019/7/14,Institute of Computer Software Nanjing University,2,Acknowledgement,本节ppt 有关CORBA部分内容从下列文献摘录或改编: Bamshad Mobasher http:/maya.cs.depaul.edu/mobasher/classes/ds5

2、20/ Douglas C. Schmidt http:/www.cs.wustl.edu/schmidt/corba.html,2019/7/14,Institute of Computer Software Nanjing University,3,摘要,背景 Why, What, How 一般框架 CORBA Java RMI,2019/7/14,Institute of Computer Software Nanjing University,4,背景,分布式计算(Distributed computing) What: the process of running a single

3、computational task on more than one distinct computer - from Wikipedia Compare to “Parallel Computing” Why? How? 实践表明,分布式应用系统的开发比集中式应用系统开发困难的多。,2019/7/14,Institute of Computer Software Nanjing University,5,分布式计算,Why? “世界是分布的”。 有时将涉及的用户、应用、数据集中化不合适、不可行。 资源共享 并行处理 冗余容错 The main goal of a distributed c

4、omputing system is to connect users and resources in a transparent, open, and scalable way. Ideally this arrangement is drastically more fault tolerant and more powerful than many combinations of stand-alone computer systems.,2019/7/14,Institute of Computer Software Nanjing University,6,Distributed

5、Systems Frameworks,7,7,The Business Model,Every application is part of your business model must make them work together!,Shipping/ Receiving,Inventory,Engineering,Manufacturing,Accounting,Payables/ Receivables,Sales,Distributed Systems Frameworks,8,8,The Problem,Application Integration and Distribut

6、ed Processing are the same thing Constructing information-sharing distributed systems from diverse sources: heterogeneous networked physically disparate multi-vendor,Distributed Systems Frameworks,9,常见分布式应用模式,Client Code,Stub,Server Code,Skeleton,Infrastructure,Client: Thin or Fat?,Client Server Com

7、puting,Distributed Systems Frameworks,10,常见分布式应用模式,Multi-Tier Systems separates persistence from logic and logic from presentation all activity originates in user interface arrows represent client-server relation,Business Logic,User Interface,Persistent Store,Distributed Systems Frameworks,11,11,常见分

8、布式应用模式,Web Applications interaction initiated by user UI based on HTML, Java, Javascript, etc. CGI/Servlet composes HTML, forwards interaction requests to business logic,Business Logic,User Interface,Data Store,Firewall,HTTP Servers,CGI / Servlets,Distributed Systems Frameworks,12,常见分布式应用模式,Peer-to-

9、Peer Systems,Application,User Interface (mixed initiative),Persistent Store,Monitor,Enterprise Applications,Requests,Notifications,Message queue,An architecture where there is no special machine or machines that provide a service or manage the network resources. Instead all responsibilities are unif

10、ormly divided among all machines, known as peers. Peers can serve both as clients and servers.,Distributed Systems Frameworks,13,分布式应用的构成,3 layers of a distributed application: network level (TCP/IP, network protocols) higher-level services (directory services, security protocols, etc.) application

11、level At the application level: processes threads objects: processes can be made up of one or more objects which can be accessed by one or more threads within the process agents: an “independent” functional element (e.g., in a banking application we may have a customer agent, a transaction agent, an

12、 information brokerage agent),Distributed Systems Frameworks,14,分布式应用的一般技术需求,Partitioning and Distributing Data and Functions data-driven distribution functional distribution object-based distribution Flexible, Extendible Communication Protocols allocation of tasks to agents has a direct influence o

13、n the complexity of the communication protocol (type of data, amount of data, persistence of connections) may also be dictated by legacy systems that need to be incorporated,Distributed Systems Frameworks,15,分布式应用的一般技术需求,Multi-threading Requirements server object may need to service multiple remote

14、clients at once effective way to optimize resources Security Requirements authentication of client identities define resource access levels data encryption,分布计算,How? 理想主义:Distributed Operating System 现实主义: 操作系统提供网络通信功能 (中间件) 分布应用程序,2019/7/14,Institute of Computer Software Nanjing University,16,分布计算,

15、Socket programming in Java,2019/7/14,Institute of Computer Software Nanjing University,17,17,/ listen to port 5000 on the local host for socket connection requests ServerSocket s = new ServerSocket(5000); while (true) / wait for connection request from client Socket clientConn = s.accept(); InputStr

16、eam in = clientConn.getInputStream(); OutputStream out = clientConn.getOutputStream(); / now IO streams are connected to client; do something with them.,分布计算,2019/7/14,Institute of Computer Software Nanjing University,18,18,/ create the socket InetAddress addr = InetAddress.getByName(“our.remote.hos

17、t”); Socket s = new Socket(addr, 5000); InputStream in = s.getInputStream(); OutputStream out = s.getOutputStream(); / now we have IO streams to remote process; do something with them.,分布计算,Message Passing Libraries PVM (Parallel Virtual Machine), MPI (Message Passing Interface) Send/Recv, Multicast

18、 Virtual Shared Memory OpenMP,2019/7/14,Institute of Computer Software Nanjing University,19,分布计算,远程过程调用(RPC,Remote Procedure Call) 让应用程序开发者可以 象调用本地过程一样调用分布在远程节点上的过程 将结构化方法用于分布环境 实现上 Request Response 消息传递模式 provides a function-oriented interface to socket-level communications (sits on top of the TCP

19、/IP transport layer),2019/7/14,Institute of Computer Software Nanjing University,20,摘要,背景 Why, What, How 一般框架 CORBA Java RMI,2019/7/14,Institute of Computer Software Nanjing University,21,Distributed Systems Frameworks,22,Distributed Systems Frameworks,22,General Pattern for Remote Invocation,Call:

20、marshal arguments convert to network format locate server transmit data,Client Code,Stub,Server Code,Skeleton,Infrastructure,Serve: receive data convert & unmarshal invoke method marshal return value transmit data,Distributed Systems Frameworks,23,Distributed Systems Frameworks,23,Procedural API for

21、 Remote Invocation,DCE (Distributed Computing Environment) OSF standard for RPC provides a common set of services Directory Services-Store the names of resources that are available within the distributed environment. The Cell Directory Service (CDS) supports naming within a cell, and the Global Dire

22、ctory Service (GDS) supports naming across all cells within an enterprise. GDS implements the X.500 directory service standard. Distributed File Service (DFS)-An optional DCE service that provides a seamless file system that operates across all computers contained within a cell. Distributed Time Ser

23、vice (DTS)-Used for synchronization. Security Service-Used for authentication and control access. DCE Threads-Similar to Java threads. They are lightweight processes that simplify the design of client/server applications.,分布对象计算(DOC),让应用程序开发者可以象使用本地对象一样使用远程对象 对象计算模型和分布计算模型的结合 自然 decentralized nature

24、 of dist. computing encapsulation required by distributed components information hiding requirements (location transparency, security, etc.) 优越:,2019/7/14,Institute of Computer Software Nanjing University,24,分布对象技术,Location Transparency,2019/7/14,Institute of Computer Software Nanjing University,25,

25、Machine 1,Machine 2,Caller,Proxy,Implementor,local call,remote call,分布对象技术,Proxy Pattern,2019/7/14,Institute of Computer Software Nanjing University,26,分布对象技术,Providing the same enhancements to procedural RPC toolkits that OO languages provide to conventional procedural languages 实现对象计算的全面支持 encapsu

26、lation, interface inheritance, object-based exception handling 良好的软件组织 promotes separation of interface from implementation (crucial for scalable distributed applications) 甚至DbC,2019/7/14,Institute of Computer Software Nanjing University,27,Key Advantages of DOC,Enabling interworking between applica

27、tions at a higher level of abstraction developing distributed applications using familiar techniques such as method calls on objects again, location transparency Providing a foundation for building higher-level mechanisms that facilitate collaboration among services in distributed applications commo

28、n object services (e.g., global naming, transactional messaging, quality of service facilities, etc.),2019/7/14,Institute of Computer Software Nanjing University,28,分布对象计算,实现分布对象计算的几个核心概念 接口 对象引用 参数传递 相关服务设施 底层通信协议,2019/7/14,Institute of Computer Software Nanjing University,29,显式、抽象的对象接口定义,allow cli

29、ents to access objects regardless of implementation details allow object server flexibility in implementing objects existing services may be incorporated via wrappers platform-independent specification languages interface descriptions can be converted into server skeletons which can be compiled and

30、implemented in any language some object interfaces also generate client stub interfaces. Examples: CORBA: Interface Definition Language (IDL) DCOM: Component Object Model language,2019/7/14,Institute of Computer Software Nanjing University,30,远程对象引用,对象通过相互引用来通信 本地对象引用:仅在当前地址空间有效 运行系统维护; 远程对象引用 不同地址空

31、间? 异构? 生命周期? 需要某种“对象管理器”来支持、维护之,2019/7/14,Institute of Computer Software Nanjing University,31,对象管理器(Object Manager),The core of a distributed object system Manages object skeletons and object references on the server E.g., Object Request Broker (ORB) in CORBA or Registry Service in RMI When a clien

32、t requests a new object, the object manager locates the skeleton for the class of the requested object creates new instance based on skeleton stores new object in the object storage sends a reference to the new object back to the client,2019/7/14,Institute of Computer Software Nanjing University,32,

33、对象管理器,Remote method calls by clients are routed by object manager to the proper object on the server Object manager may also destroy objects after clients are done Some other possible features of OM dynamic object activation/deactivation persistent objects,2019/7/14,Institute of Computer Software Na

34、njing University,33,Registration / Naming Service,Acts as an intermediary between the object client and the object manager Once the interface to an object is defined, an implementation of the interface must be registered with the service so that it can be addressed by clients Through the naming serv

35、ice the client can specify the type of the object it needs or the name of a particular object, if it already exists,2019/7/14,Institute of Computer Software Nanjing University,34,对象通信协议,General protocol for handling remote object requests Must support a means of transmitting and receiving object and

36、 method references, and data in the form of objects or basic data types Ideally should be transparent to clients should interact with local object proxies (stubs) and let the object distribution scheme handle communication behind the scenes,2019/7/14,Institute of Computer Software Nanjing University

37、,35,分布计算的一般框架,2019/7/14,36,IDL Compilers,Registration Service,Object Skeleton,Object Storage,Object Manager,Naming Service,Client Application,Server Implementation,Client Stub Interface,运行时刻远程对象交互,2019/7/14,Institute of Computer Software Nanjing University,37,Object Stubs,Server Object Implementatio

38、n,Object Skeleton,Object Manager Naming Service,Client Application,2. Resolve Object,4. Object Interactions,1. Request Object,3. Object Handle,Comparing DOC Frameworks,2019/7/14,Institute of Computer Software Nanjing University,38,Distributed Object Computing Frameworks CORBA - Common Object Request

39、 Broker Architecture, an industry standard developed by OMG DCOM - Microsofts Distributed Component Object Model, a descendant of DCE RPC RMI - Javas Remote Method Invocation,摘要,背景 Why, What, How 一般框架 CORBA Java RMI,2019/7/14,Institute of Computer Software Nanjing University,39,OMG Reference Model A

40、rchitecture,2019/7/14,Institute of Computer Software Nanjing University,40,Object Management Architecture,Object Services Domain-independent foundational services for use by developers of implementation objects some published services: Naming: allows clients to find objects based on names Trading: a

41、llows clients to find objects based on their properties Lifecycle management Event notification Transactions Security ,2019/7/14,Institute of Computer Software Nanjing University,41,Object Management Architecture,Common Facilities object services provide functionality for use by objects, CORBA facil

42、ities provide standards for services used by applications generic functionality needed by many applications (e.g., printing, document management, email, etc.),2019/7/14,Institute of Computer Software Nanjing University,42,Object Management Architecture,Domain Interfaces provide domain-specific objec

43、ts for vertical application domains Examples: Finance, Healthcare, Manufacturing, Telecom, Electronic Commerce, Transportation Application Interfaces Thus not standardized,2019/7/14,Institute of Computer Software Nanjing University,43,Common Object Request Broker Architecture,一个典型的分布对象计算架构 The archi

44、tecture 对象 Objects and Clients 接口 OMG IDL “对象管理器” ORB 底层通信协议 IIOP 其他,2019/7/14,Institute of Computer Software Nanjing University,44,2019/7/14,Institute of Computer Software Nanjing University,45,Distributed Systems Frameworks,46,Distributed Systems Frameworks,Overview of CORBA Objects,CORBA Object C

45、ORBA objects differ from typical programming language objects: CORBA objects can be located anywhere on a network. CORBA objects (like Java objects) can run on any platform. CORBA objects can be written in any of several languages. CORBA object developers need know nothing of where their clients wil

46、l be, what hardware or OS they will run on, or what language they will be written in. CORBA objects approach universal accessibility.,Distributed Systems Frameworks,47,Distributed Systems Frameworks,Overview of CORBA Objects,An object implementation provides the semantics of the object, usually by d

47、efining data for the object instance and code for the objects methods. (called a “servant”) A client of an object has access to an object reference for the object, and invokes operations on the object. A client knows only the logical structure of the object according to its interface and experiences

48、 the behavior of the object through invocations. Client code has no knowledge of the implementation of the object or which ORB is used to access the implementation.,Distributed Systems Frameworks,48,Role of OMG IDL,Distributed Systems Frameworks,ORB,I D L,I D L,I D L,I D L,I D L,I D L,Client Side,Ob

49、ject Implementation Side,COBOL,C,Ada,C+,Small talk,JAVA,I D L,I D L,I D L,I D L,I D L,I D L,C+,COBOL,Small talk,JAVA,Internet InterORB Protocol (IIOP),Distributed Systems Frameworks,49,Distributed Systems Frameworks,OMG IDL,OMG Interface Definition Language (IDL): mappings for many languages/compilers; independent of any particular language/compiler; multiple-inheritance, public interface-structured specification language; not for implementation. primary support for interoperability

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 其他


经营许可证编号:宁ICP备18001539号-1