Distributed Systems Topic 6 Resolving Heterogeneity Dr Michael
Distributed Systems Topic 6: Resolving Heterogeneity Dr. Michael R. Lyu Computer Science & Engineering Department The Chinese University of Hong Kong © Chinese University, CSE Dept. Distributed Systems / 6 - 1
Outline ¨ Heterogeneous Programming Languages – Common Object Model – Common Interface Definition Language – Programming Language Bindings ¨ Heterogeneous Middleware – Interoperability – Interworking ¨ Heterogeneous Data Representation – Standardized Data Representation – Application-Level Transport Protocol – Virtual Machines © Chinese University, CSE Dept. Distributed Systems / 6 - 2
1. 1 Heterogeneous Languages: Motivation ¨ Components of distributed systems are written in different programming languages ¨ Programming languages may or may not have their own object model ¨ Object models largely vary ¨ Differences need to be overcome in order to facilitate integration and portability © Chinese University, CSE Dept. Distributed Systems / 6 - 3
1. 1 Heterogeneous Programming Languages 1 Polylingual applications. 2 Standardization of bindings. 3 Available bindings. 4 What bindings need to address. 5 An example: IDL/C++. © Chinese University, CSE Dept. Distributed Systems / 6 - 4
1. 1 Polylingual Applications ¨ Polylingual applications have components in different programming languages. ¨ Language bindings address language interoperability. ¨ Problem: with n different languages, n(n-1) different language bindings needed. ¨ Solution: One language (such as IDL) as a mediator. Requires only n bindings. © Chinese University, CSE Dept. Distributed Systems / 6 - 5
1. 1 Why do we use an IDL? PL 1 PL 2 PL 6 PL 1 PL 3 PL 5 © Chinese University, CSE Dept. PL 4 PL 6 PL 2 IDL PL 5 PL 3 PL 4 Distributed Systems / 6 - 6
1. 2 Interface Definition Language ¨ Language for expressing all concepts of the middleware’s object model ¨ Should be – programming-language independent – not computationally complete ¨ Bindings to different programming languages are needed ¨ As an example: OMG object model and OMG/IDL © Chinese University, CSE Dept. Distributed Systems / 6 - 7
1. 2 Polylingual Applications with IDL Object Implementation Side Client side Java Client © Chinese University, CSE Dept. IDL Infrastructure IDL C++ Object Implementation Distributed Systems / 6 - 8
1. 3 CORBA Programming Language Bindings Smalltalk IDLscript C++ Ada IDL C Common Object Model Lisp © Chinese University, CSE Dept. Java Python Cobol Distributed Systems / 6 - 9
1. 4 What Bindings Need to Address ¨ Atomic data types and type constructors ¨ Constants ¨ Interfaces and multiple inheritance ¨ Object references ¨ Attribute accesses ¨ Operation execution requests ¨ Exceptions ¨ Invocation of ORB operations © Chinese University, CSE Dept. Distributed Systems / 6 - 10
1. 5 An Example: IDL/C++ 1 Modules 2 Atomic Types 3 Records 4 Interfaces 5 Attributes 6 Operations 7 Inheritance 8 Exceptions 9 Operation Execution Requests © Chinese University, CSE Dept. Distributed Systems / 6 - 11
1. 5. 1 Modules IDL: module Bank. Application {. . . }; C++: namespace Bank. Application {. . . }; © Chinese University, CSE Dept. Distributed Systems / 6 - 12
1. 5. 2 Atomic Types IDL C++ short long unsigned short unsigned long float double char boolean octet enum CORBA: : Short CORBA: : Long CORBA: : UShort CORBA: : ULong CORBA: : Float CORBA: : Double CORBA: : Char CORBA: : Boolean CORBA: : Octet enum © Chinese University, CSE Dept. Distributed Systems / 6 - 13
1. 5. 3 Records IDL struct info { long height; short weight; }; C++ struct info { CORBA: : Long height; CORBA: : Short weight; }; © Chinese University, CSE Dept. Distributed Systems / 6 - 14
1. 5. 4 Interfaces IDL interface person {. . . }; C++ class person {. . . }; © Chinese University, CSE Dept. Distributed Systems / 6 - 15
1. 5. 5 Attributes IDL interface person { attribute readonly string name; attribute address lives_at; }; C++ class person { public: string name(); void lives_at(address &); address lives_at(); }; © Chinese University, CSE Dept. Distributed Systems / 6 - 16
1. 5. 6 Operations IDL interface person { void move(in address new); }; C++ class person { public: void move(const address & new); }; © Chinese University, CSE Dept. Distributed Systems / 6 - 17
1. 5. 7 Inheritance IDL interface employee : person {. . . person boss(); }; C++ class employee : public virtual person { public: person boss(); }; © Chinese University, CSE Dept. Distributed Systems / 6 - 18
1. 5. 8 Exceptions IDL C++ interface employee : person { exception too_young{. . . }; void retire() raises (too_young); }; class employee : public virtual person { public: class too_young: public User. Exception { too_young (const char *id); ~too_young (); }; void retire() throw (too_young); }; © Chinese University, CSE Dept. Distributed Systems / 6 - 19
1. 5. 9 Operation Execution Requests C++ employee * emp; . . . try { emp->retire(); } catch (const too_young &Is. Too. Young){ // Handle the Specific Exception } catch (const System. Exception &Sys. Ex){ switch (Sys. Ex->minor() ) { case BAD_PARAM : . . . ; break; case NO_MEMORY : . . . ; break; }; }; © Chinese University, CSE Dept. Distributed Systems / 6 - 20
2 Need for Heterogeneous Middleware ¨ Middleware implementations differ: – Available programming language bindings – Available services & facilities – Supported hardware platforms – Supported operating system platforms ¨ Separation of security domains. ¨ Large scale distributed systems. © Chinese University, CSE Dept. Distributed Systems / 6 - 21
2. 1 Heterogeneous Middleware Component Component Middleware Vendor A © Chinese University, CSE Dept. Component Middleware Vendor B Middleware Vendor C Distributed Systems / 6 - 22
2. 2 Middleware Integration Component Component OLE ORB ORB Bridge © Chinese University, CSE Dept. RPC Bridge Distributed Systems / 6 - 23
2. 2 Bridging ¨ in-line Client ¨ request-level Obj. Imp. Client Obj. Imp. DSI OR ore BC © Chinese University, CSE Dept. B OR e Cor DII ore O C RB Distributed Systems / 6 - 24
2. 3 Interoperability vs. Interworking ¨ Interoperability denotes the ability of different implementations of the same middleware standard to work together. Requires – Definition of interaction protocols ¨ Interworking defines how different middleware standards are integrated. Requires – Mapping of object models – Definition of interaction protocols © Chinese University, CSE Dept. Distributed Systems / 6 - 25
2. 3 Interoperability vs. Interworking ¨ Interoperability between different implementations of the same standard (CORBA) ¨ Interworking between different standards – CORBA « DCE – CORBA « COM/DCOM/OLE ¨ First CORBA interoperability ¨ Then COM/CORBA interworking © Chinese University, CSE Dept. Distributed Systems / 6 - 26
2. 4 Interoperability Protocols Applications CORBA 2. 0 ESIOP GIOP IIOP DOETalk . . . . DCE-CIOP . . . . Mandatory: provides "out of the box" interoperability © Chinese University, CSE Dept. Distributed Systems / 6 - 27
2. 4. 1 General Inter-ORB Protocol (GIOP) ¨ Define eight messages: – Request – Reply – Fragment – Locate Request – Locate Reply – Cancel request – Close Connection – Message Error © Chinese University, CSE Dept. Distributed Systems / 6 - 28
2. 4. 2 Common Data Representation ¨ Defined as part of GIOP. ¨ Presentation layer implementation to support heterogeneity. ¨ Mapping of IDL data types to transport byte stream. ¨ Encodings of – primitive types – constructed types – interoperable object references © Chinese University, CSE Dept. Distributed Systems / 6 - 29
2. 4. 3 Internet Inter-ORB Protocol (IIOP) ¨ Maps GIOP to TCP/IP. ¨ Provides operations to open and close TCP/IP connections. ¨ Is required from ORBs for CORBA compliance. ¨ Supported by Netscape Communicator and others. © Chinese University, CSE Dept. Distributed Systems / 6 - 30
2. 5 Motivation for Interworking ¨ COM and OLE/Automation are widely used for desktop integration of PC applications – Compound documents – Visual Basic / Visual C++ User Interfaces. ¨ OMG has no support for compound documents and user interfaces yet. ¨ COM and OLE do not support distribution. ¨ CORBA was designed to support distribution. © Chinese University, CSE Dept. Distributed Systems / 6 - 31
2. 5. 1 COM-CORBA Interworking ¨ Goal: provide transparent bi-directional mapping between COM/OLE and CORBA. ¨ Adopted specification was submitted by consortium of 11 ORB vendors. Most of them have COM/OLE Interworking implemented in their ORB products. ¨ Microsoft decided not to be involved in this effort but rather pursue its own distributed object environment (DCOM). ¨ CORBA 2. 2 specification defines interworking between CORBA and DCOM. © Chinese University, CSE Dept. Distributed Systems / 6 - 32
2. 5. 2 Interworking Architecture Object System A Object System B Bridge objref in A objref in B View in A of target in B © Chinese University, CSE Dept. target object implementation in B Distributed Systems / 6 - 33
2. 5. 3 Architecture Instantiations Bridge Target CORBA object COM view of CORBA object CORBA server COM client CORBA objref CORBA client © Chinese University, CSE Dept. CORBA server CORBA objref Bridge CORBA view of COM object Target CORBA object Target COM object COM server CORBA view of Autom. object CORBA client Autom. view of CORBA object Automation client Bridge Automation object Automation server Distributed Systems / 6 - 34
2. 5. 5 CORBA ® COM ¨ Enables COM Clients to access CORBA objects ¨ Fairly straight-forward mapping: – IDL atomic types map closely to COM primitives – Constructed types also map closely – CORBA object references map to COM interface pointers – Inherited CORBA interfaces may be represented as multiple COM interfaces – CORBA attributes mapped to ´set´ and ´get´ operations in COM. © Chinese University, CSE Dept. Distributed Systems / 6 - 35
3 Heterogeneous Data Representation ¨ Examples of Heterogeneity – Big-endian versus little-endian data representation – Different encoding schemes for character set – Different ways complex data types are implemented by run-time environment of programming languages ¨ Resolution: Standardized Data Representation ¨ Resolution: Application-Level Transport Protocol ¨ Resolution: Virtual Machines © Chinese University, CSE Dept. Distributed Systems / 6 - 36
4 Summary ¨ Polylingual applications. ¨ IDL programming language bindings. ¨ Heterogeneous Middleware ¨ Heterogeneous Data Representation. © Chinese University, CSE Dept. Distributed Systems / 6 - 37
- Slides: 37