1 / 30

Embedded Middleware

Embedded Middleware. Lecture 23. Previous Lecture. Source of deterministic errors and random noises Basics of signal spectrum Nyquist sampling Fourier transform Basic filters What you can do and when you should ask for help. Overview of Today’s Lecture. What is middleware? CORBA

ken
Télécharger la présentation

Embedded Middleware

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. Embedded Middleware Lecture 23

  2. Previous Lecture • Source of deterministic errors and random noises • Basics of signal spectrum • Nyquist sampling • Fourier transform • Basic filters • What you can do and when you should ask for help

  3. Overview of Today’s Lecture • What is middleware? • CORBA • Java (EJB) • DCOM • Comparing different middleware • Get to know one middleware (CORBA) in depth • Middleware in embedded systems • What are the criteria?

  4. Moving Beyond A Single Processor • So far, we’ve only dealt with the issues of a single embedded processor • What if we want to get embedded processors to run applications that communicate across the network? • Networked/distributed programs • Processes that communicate over the network (or on the same machine) • Client – piece of code that requests services • Server – piece of code that provides the services

  5. Writing Distributed Programs • Common ways of writing distributed client-server programs • Sockets • Low-level interface to the operating system for TCP and UDP • STREAMS • Even lower-level interface within the kernel (almost device-driver level) • Shared memory • Low-level interface for clients and servers on the same machine to communicate using a chunk of memory that they share • Shared files • Clients and servers exchange information through a shared file system • RPC (Remote Procedure Call) • Clients communicate with long-lived server processes (daemons) over the network

  6. Socket Programming • Server’s role • Binds to an Internet (IP) address • Listens for clients on the network • Provides services to clients that connect to it • Client’s role • Knows the server’s IP address • Connects to the server • Sends service requests • Client and server exchange messages over TCP or UDP • Socket/networking code mixed with “real” client and server logic Server Client Listens for more clients TCP or UDP TCP or UDP Exchange of messages over an established connection

  7. Low-level Network Programming • Very efficient mechanism • Available on almost every operating system • Standardized application programming interface (API) • Can be used for clients and servers to communicate on the same machine and across the network • But ….. • Exposes too many low-level details • Application writer must be able to debug network-level issues and problems • Mixes application logic with networking logic • Clients must know where servers live • If client and server run on different byte-ordered machines, they must be aware of these differences in talking to each other

  8. ….. And Middleware was Born • Layer between the operating system and the application • Hides the operating system’s details from the application developer • CORBA, EJB, DCOM • Why do we need/have middleware? • It makes it easier to write distributed applications • Takes care of all the networking code and the messaging • Leaves you free to focus on writing the application

  9. Written in some neutral Interface Definition Language (IDL) Server Interface Server’s real implementation (in a programming language) Client’s real implementation (in a programming language) IDL Compiler Client Process Server Process Client-side “Glue” Server-side “Glue” Written in a programming language, but independent of clients Middleware Middleware Some protocol over TCP/IP High-Level Overview of Middleware

  10. CORBA (Common Object Request Broker Architecture) • Middleware for interoperability from the Object Management Group • CMU is a member of the OMG, along with 800 other companies/universities • The key component is the “broker” (ORB) • Shields the client and the server from each other’s differences • What’s the CORBA client-server model? • Language transparency: Clients and servers can be written in different programming languages • Location transparency: Client and server don’t care about each other’s locations • Interoperability: Clients and servers can run on different hardware, operating systems and still be able to talk to each other using a protocol called IIOP • No support for distributed garbage collection • Real-Time CORBA standard available

  11. CORBA - Putting All The Pieces Together

  12. J2EE (Java 2 Enterprise Edition) • Sun Microsystems’ Java-based middleware • Implicitly has all of Java’s portability advantages • Component: application-level software unit • Container: runtime support/services for a component • On the client side • Applets, application clients executing in their own JVM • On the server side • Web components • Servlets and Java Server Pages (JSP) • Enterprise Java Beans (EJB) components can contain two kinds of objects • Session beans: valid for the duration of a client-server session • Entity beans: valid for the lifetime of the persistent data that it manages • What makes J2EE powerful? • Can interface to multiple existing back-end systems and technologies • Power of Java’s intrinsic portability, graphical, web & garbage collection capabilities • Real-Time Java standard available

  13. J2EE - Putting All The Pieces Together

  14. DCOM (Distributed Component Object Model) • Microsoft’s middleware • DCOM server • Body of code containing multiple objects • Each object can support multiple interfaces • Can be written in Java, C++, Pascal • DCOM client • Gets a pointer to one of the interfaces • Talks to the server over that interface • Doesn’t care if the server is local or remote • Client-server communication • Occurs over the Object Remote Procedure Call (ORPC) • Originates from DCE’s RPC (where Distributed Computing Environment, or DCE, was one of the earliest middleware platforms) • The broker is called the Service Control Manager (SCM) • Some support for distributed garbage collection

  15. DCOM - Putting All The Pieces Together

  16. Critical Thinking What are the differences between DCOM, EJB and CORBA?

  17. Server’s IDL Interface CORBA SERVER CORBACLIENT Servant Client Logic IDL-to-Java/C++ Compiler Java/C++ Skeleton Java/C++ Stub POA ORB ORB Platform Platform IIOP (Internet Inter-ORB Protocol) Overview of CORBA

  18. Interface Definition Language (IDL) • Used to define • Interfaces: methods or behavior (but not attributes or state) of a server object • Modules: packages of related interfaces and types • IDL is not a programming language • No conditional constructs such as if, else, then, while, do, etc. • IDL compiler • Provided with every ORB • Input = Server’s interface in IDL • Output = Skeleton and stub in a programming language (Java, C++, etc.) • What are the IDL types? • Basic types: octet, char, short, long, double • Structured types: string, sequence<someOtherType>, union, struct • Arbitrary types: any • User-defined types: e.g., interfaces

  19. Example of an IDL Interface moduleBank { exceptionZeroBalance {}; typedef sequence<double> DepositHistory; interface Account { string getBalance(instring accountNumber); void depositMoney(indouble amount, out double balance, inout DepositHistory latest); double withdrawMoney (in double amount) raises(ZeroBalance); }; };

  20. Stubs and Skeletons • What is a stub, anyway? • Automatically generated by the IDL compiler • Client-side glue in Java/C++ • Marshals (packages) parameters from the client into a message to be sent to the server • Unmarshals results from the response message • What is a skeleton, anyway? • Automatically generated by the IDL compiler • Server-side glue in Java/C++ • Unmarshals (unpackages) messages into the parameters that the client intended to send • Marshals results into a response message

  21. Portable Object Adapter (POA) • Exists only within CORBA servers • Dispatches incoming requests to the right target servants • Also acts as a namespace for the collection of servants it manages • Additional policies that you can use to customize a POA: • Multithreading • Activation on demand • Persistent references (lifespan of objects) • Unique object identifiers • A server process can have multiple POAs, each configured differently, and each responsible for a certain set of servants

  22. CORBA’s Protocols • General Inter-ORB Protocol (GIOP) • Specification of a protocol, and not the implementation • Eight message formats: Request, Reply, LocateRequest, LocateReply, CancelRequest, MessageError, CloseConnection, Fragment • Well-defined headers for every message • Carries the sender’s byte ordering • Can be mapped onto any “real” protocol that is connection-oriented • Internet Inter-ORB Protocol (IIOP) • Concrete implementation of GIOP specification onto TCP/IP • Must be supported by every ORB • Allows objects to communicate without caring about their operating systems, hardware architectures, etc.

  23. Other CORBA Components • Implementation Repository • Stores location of the executables in your file system • Run-time registry of servers and clients • Very specific to the vendor • Interface Repository • Stores the type information of all CORBA objects in your application • Dynamic invocation interface implies that you don’t know your types ahead of time, and you can look these up at run-time • Naming Service • Registry of user-friendly names associated with object references • Servants can bind references by a name • Clients can look up references by that name

  24. Server Client string_to_object() object_to_string() IOR:0100…. Interoperable Object References (IORs) • Stringified format of a reference • Can be stored in a file, sent across the network, etc. • Contains server’s hostname, port number, object key, etc. • Sample IOR looks like this: IOR:010000001000000049444c3a4163636f756e743a312e30000200000000000000300000000101000013000000752d6d61792e7468696e6b6f6e652e636f6d00007b0900000c000000424f410a20b0530000055030100000024000000010000000100000001000000140000000100000001000100000000000901010000000000

  25. System and User Exceptions • Exception – Something bad/illegal/undesirable occurred • System Exceptions • Defined within the CORBA standard • Can alert the application of communication errors, resource exhaustion, invalid object references, host crashes • Usually raised by the ORB before the request gets to the servant • Format of a System Exception • Minor code: Identifies the source of the problem (e.g., COMM_FAILURE) • Completion status: COMPLETED_YES, COMPLETED_NO, COMPLETED_MAYBE • Make sure that your CORBA clients catch system exceptions! • User Exceptions • Can be defined within IDL interfaces • Each method of an interface can raise exceptions

  26. Inside Your Netscape Browser

  27. Middleware in Embedded Systems • Requirements • Limited resources: Smaller footprint (requires less code-bloat) • Real-time support (available in Real-Time CORBA specification) • Full CORBA implementation: 150 Kbytes – 5 Mbytes! • What are your options? • Minimal CORBA: Throw out some of the heavyweight CORBA mechanisms (~ 30-60 Kbytes) • IIOP Engine: Use a library that keeps only the IIOP protocol part (~ 15 Kbytes) • CORBA Gateways: TCP bridge from the embedded processors to a CORBA gateway that talks to the rest of the world

  28. Using CORBA Gateways

  29. Summary of Lecture • What is middleware? • CORBA • Java (EJB) • DCOM • Compare the different middleware • Get to know one middleware (CORBA) really well • Middleware in embedded systems • What are the criteria?

More Related