Virtual-Component.Pdf

Virtual-Component.Pdf

Virtual Component A Design Pattern for Memory-Constrained Embedded Applications Angelo Corsaro, Douglas C. Schmidt, Raymond Klefstad, Carlos O’Ryan g fcorsaro,schmidt,klefstad,coryan @ece.uci.edu Electrical and Computer Engineering Department University of California, Irvine, CA 92697, USA Abstract 2 Example The proliferation of embedded systems and handheld de- There is a trend to develop memory-constrained applica- vices with limited memory is forcing middleware and ap- tions, such as embedded systems, using feature-rich mid- plication developers to deal with memory consumption as dleware, such as Java RMI [5], COM+ [6], or CORBA [7]. a design constraint [1]. This paper uses the POSA for- Memory-contrained applications have historically been mat [2] to present the Virtual Component compound pat- developed manually and hard-coded to use low-level lan- tern [] that helps to reduce the memory footprint of mid- guages and software tools, which is tedious and error- dleware, particularly standards-based middleware such prone. The growing use of middleware provides a more as CORBA or J2EE, by transparently migrating compo- powerful distributed computing model that enables clients nent functionality into an application on-demand. This to invoke operations on reusable components without compound pattern applies the Factory Method [3], the hard-coding dependencies on their location, programming Proxy [3], and Component Configurator [4] design pat- language, OS platform, communication protocols and in- terns to achieve its goals. We describe the Virtual Compo- terconnects, and hardware [8]. nent pattern as a separate named abstraction since each However, middleware (particularly standards-based of these constituent pattern does not independently re- middleware) often has many features that are not be solve the set of forces addressed by the Virtual Component needed by all applications that use it. For example, in pattern. the context of CORBA: Keywords: Design Patterns, Embedded Systems, A server application may not actually use all three Memory Footprint, CORBA, Abstract Factory, Compo- versions (i.e. version 1.0, 1.1 and 1.2) of the standard nent Configurator. CORBA Internet inter-Orb protocol (IIOP). A client application may not need to use all the col- location optimizations, interceptors, or smart proxy 1Intent mechanisms specified in the CORBA standard. “Pure client” CORBA applications that invoke re- The Virtual Component design pattern provides an quests, but do not service requests from other clients, application-transparent way of loading and unloading do not require a portable object adapter (POA) (a components that implement middleware software func- POA maps client requests to the appropriate servant tionality. This pattern ensures that the middleware pro- in a CORBA server). vides a rich and configurable set of functionality, yet oc- cupies main memory only for components that are actu- Providing all these features in one monolithic imple- ally used. mentation increases middleware footprint, which may 1 make it unsuitable for use in memory-constrained appli- 4Problem cations. Two types of footprint are important to memory- constrained applications: Middleware provides developers with a powerful and Static footprint, which is the amount of storage reusable set of abstractions for building applications. Im- needed to hold an image of an application. This plementing memory-constrained applications via reusable storage can reside in the ROM where the program middleware remains hard, however, since the following is stored, on secondary disk storage, etc. The static forces must still be resolved: footprint of a particular version of a particular appli- 1. The specifications for features and options for mid- cation is time-invariant since it does not change as dleware (particularly standards-based middleware) the application runs. are large and continually growing Dynamic footprint, which represents the amount of 2. Middleware implementations can incur a large static memory used by a running instance of the applica- and dynamic memory footprint unless they are de- tion. The dynamic footprint is essentially the sum of signed in advance to avoid this and the code,theheap,andstack size. Based on this def- inition, it is clear that the dynamic footprint is time- 3. Memory-constrained applications cannot afford to dependent. For memory-constrainted applications, it waste storage on unnecessary or rarely used func- is essential to have a hard upper bound on the dy- tionality. namic footprint size. In addressing the previous forces, care must be taken to One way to reduce middleware footprint is to provide provide a solution that: compile-time options that produce subsets of middleware 1. Presents a clean architecture that is amenable to tailored for the needs of each specific application. As the reuse and can be retargeted easily. number of capabilities in the middleware grows, however, 2. Does not introduce accidental complexity in the ex- this solution does not scale well since it either posed API, i.e. is transparent. Forces application developers to know in advance Supporting all the features and options specified by what features they will require or middleware can therefore create a large memory foot- Increases the development cycle by forcing applica- print, making the middleware unsuitable for memory- tion developers to recompile the middleware when- constrained applications. ever they change the set of features they require. Few applications use all the functionality provided by In addition, compile-time subsetting approaches may middleware. However, implementers of middleware can- not reduce middleware dynamic memory footprint suffi- not wantonly eliminate capabilities from their products ciently since the resources associated with infrequently based on the needs of any particular application. Mid- used components will be allocated during execution–even dleware must therefore be designed to support easy cus- if they are not used during a particular run of an appli- tomization to meet application functionality requirements cation. It is therefore necessary to devise a more effec- and memory constraints. tive technique to reduce static and dynamic footprint of ! middleware by removing unneeded functionality and pro- , Implementations of standard CORBA must be pre- viding fine-grained control over the different middleware pared to provide all the services in the specification, even components used by an application at run-time. though applications rarely use all its features. For exam- ple, business applications use only a few transport proto- cols or QoS policies. Likewise, embedded applications 3 Context may not use the CORBA Any data type, or may choose to use Anys in a limited way. Moreover, real-time ap- Componentized middleware, where configurability and plications rarely use middleware meta-programming fea- customizability is needed to meet memory constraints im- tures [9], such as the CORBA dynamic invocation inter- posed by application requirements and the run-time plat- face (DII) that discovers and invokes operations on ob- form. jects at run-time. 2 5 Solution Class Collaborator Component Identify components whose interfaces represent the build- Responsibility ing blocks of the middleware being developed and imple- Define an interface for a well defined and encapsulated service ment these capabilities using concrete components.Use provided by the middleware factories to create the concrete components needed by an application via a set of loading/unloading strategies that provide different ways to instantiate and manage the con- crete components into applications that do not re- crete components occupying memory at run-time. This quire their capabilities. pattern virtualizes each component since the middleware ! , For example, the implementation of a POA in a does not know whether a component is present or when it particular ORB is a concrete component. will be instantiated until its functionality is actually used. In detail: each component identified during the mid- dleware decomposition should be implemented in a man- Class Collaborator ConcreteComponent ner that is as decoupled from other components as pos- sible. A concrete component should be associated with Responsibility Provide an implementation for the a loading strategy to support different application use- service defined by the Component cases, e.g., some concrete components should be loaded eagerly, whereas others should be loaded lazily. Compo- nent unloading can also be done eagerly (e.g., as soon as Component factory, defines an interface and a fac- the instance reference count goes to zero) or lazily (e.g., tory method that creates components. ! when when memory gets low, unload components with , For example, the component factory in CORBA zero reference count based on a least-recently-used al- is the CORBA::ORB interface, whose resolve_ gorithm, etc.). The Virtual Component pattern provides initial_references() operation is a factory component-level control over the subset of functionality method that returns an object reference to a compo- that is needed for a given application, thereby minimiz- nent based on a string parameter passed to the op- ing the overall static and dynamic footprint by controlling eration. Other factory methods in CORBA include when, how, and what components will be instantiated as CORBA::Object::_narrow() and CORBA:: the application runs. ORB::string_to_object(). Class Collaborator 6 Structure ComponentFactory Responsibility

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    13 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us