Download presentation
Presentation is loading. Please wait.
Published byClinton Jacobs Modified over 9 years ago
1
18-349: Introduction to Embedded Systems Embedded Middleware Lecture 23
2
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems Socket Programming Server’s role 1.Binds to an Internet (IP) address 2.Listens for clients on the network 3.Provides services to clients that connect to it Client’s role 1.Knows the server’s IP address 2.Connects to the server 3.Sends service requests Client and server exchange messages over TCP or UDP Socket/networking code mixed with “real” client and server logic Client Server Exchange of messages over an established connection Listens for more clients TCP or UDP
7
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems ….. 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
18-349: Introduction to Embedded Systems High-Level Overview of Middleware Client Process Server Process Server’s real implementation (in a programming language) Client’s real implementation (in a programming language) Middleware Some protocol over TCP/IP IDL Compiler Client-side “Glue” Server-side “Glue” Written in a programming language, but independent of clients Server Interface Written in some neutral Interface Definition Language (IDL)
10
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems CORBA - Putting All The Pieces Together
12
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems J2EE - Putting All The Pieces Together
14
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems DCOM - Putting All The Pieces Together
16
18-349: Introduction to Embedded Systems Critical Thinking What are the differences between DCOM, EJB and CORBA?
17
18-349: Introduction to Embedded Systems Overview of CORBA CORBA CLIENT CORBA SERVER IDL-to-Java/C++ Compiler Java/C++ Stub Java/C++ Skeleton Server’s IDL Interface Platform IIOP (Internet Inter-ORB Protocol) Platform POA Client Logic Servant ORB
18
18-349: Introduction to Embedded Systems 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, union, struct –Arbitrary types: any –User-defined types: e.g., interfaces
19
18-349: Introduction to Embedded Systems Example of an IDL Interface module Bank { exception ZeroBalance {}; typedef sequence DepositHistory; interface Account { string getBalance( in string accountNumber); void depositMoney( in double amount, out double balance, inout DepositHistory latest); double withdrawMoney ( in double amount) raises (ZeroBalance); };
20
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems 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:010000001000000049444c3a4163636f756e743a312e30000200000000000000300000 000101000013000000752d6d61792e7468696e6b6f6e652e636f6d00007b0900000c000000 424f410a20b053000005503010000002400000001000000010000000100000014000000010 0000001000100000000000901010000000000 IOR:0100…. Server object_to_string() Client string_to_object()
25
18-349: Introduction to Embedded Systems 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
18-349: Introduction to Embedded Systems
27
Inside Your Netscape Browser
28
18-349: Introduction to Embedded Systems 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
29
18-349: Introduction to Embedded Systems Using CORBA Gateways
30
18-349: Introduction to Embedded Systems 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?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.