### ACE+TAO Subsetting

We are involved in ongoing activities to subset ACE+TAO to make them more flexible and to reduce their memory footprint for embedded systems. This document describes what we've done thus far, what we're planning to do next, and how to leverage our efforts to minimize the size of your ACE+TAO applications.

Contents

1. Motivation for Splitting ACE into Multiple Libraries
2. Configuration Management
3. Classes in Each ACE Library Subset
4. ACE Library Size Breakdown
5. Building ACE Subsets
6. ACE_OS Adaptation Layer
7. Minimum TAO
8. The Shared Library Reduction (`soreduce`) tool
9. ACE+TAO Subsetting Work in Progress

### Motivation for Splitting ACE into Multiple Libraries

This document describes how we are splitting ACE into multiple libraries, each of which will contain a smaller subset of the overall ACE functionality. The primary motivations for subsetting ACE are:

- Principle of parsimony -- i.e., developers should incur time/space overhead for components they use, rather than for all the components in the ACE framework.

- Simplify the learning curve -- i.e., developers only need to learn how to program components that they actually use.

The main design goals of our approach are as follows:

1. Support the original libACE as before. Thus, for users who want to use the existing ACE library as is, there will be no changes, i.e., just link with `libACE` as usual.

2. Allow ACE (and TAO) programmers to use smaller subsets of the entire `libACE` library. These subsets will include the following libraries:

   `libACE_OS` -- This library contains the OS adaptation layer and its supporting classes. All other ACE libraries will depend on `libACE_OS` and it will depend on no other ACE libraries.

   `libACE_Utils` -- This library contains the various ACE container classes and other miscellaneous classes, such as Singleton, auto_ptr, timers, etc. This library will depend only on `libACE_OS`.

   `libACE_Logging` -- This library contains the various ACE logging and tracing classes. This library will depend only on `libACE_OS`.

   `libACE_Threads` -- This library contains the ACE thread/process management and synchronization classes. This library will depend only on `libACE_OS`.

   `libACE_Demux` -- This library contains the ACE Reactor and Proactor classes. This library will depend on `libACE_OS` and `libACE_Thread`.

   `libACE_Connection` -- This library contains the ACE Connection components, i.e., Acceptor, Connector, and Svc_Handler. This library will depend on `libACE_OS`, `libACE_Thread`, and `libACE_Demux`.

   `libACE_Sockets` -- This library contains the ACE C++ wrappers for sockets. This library will depend on `libACE_OS`.

   `libACE_IPC` -- This library contains all the ACE C++ wrappers for the other types of IPC and FILE I/O other than sockets. This library will depend on `libACE_OS` and `libACE_Sockets`.

   `libACE_Timer` -- This library contains the ACE C++ wrappers for timer support. This library will depend on `libACE_OS`.

   `libACE_Svcconf` -- This library contains the ACE C++ wrappers for the Service Configurator. This library will depend on `libACE_OS`, `libACE_Demux`, `libACE_Thread`, and `libACE_Sockets`.

   `libACE_Streams` -- This library contains the ACE Streams classes. This library will depend on `libACE_OS`, `libACE_Demux`, and `libACE_Thread`.

   `libACE_Memory` -- This library contains the ACE C++ wrappers for shared memory and memory-mapped files. This library will depend on `libACE_OS`.

   `libACE_Token` -- This library contains the ACE C++ wrappers for token support. This library is not needed by TAO.

   `libACE_Other` -- This library contains miscellaneous code, primarily including a CORBA interface and naming support. It is not actively supported, and is not needed by TAO. Its functionality is included in TAO.

We are also planning to support the OMG's Minimum CORBA specification as part of a separate effort. Preliminary results of prototypes for Minimum CORBA we've integrate to TAO have been very promising, yielding a 40% reduction in ORB footprint.

Note that the ACE library subsets described above are intended as a guideline, not a complete specification. The actual partitioning of files in the final ACE library subsets may differ somewhat to improve footprint and simplify common use-cases.

### Configuration Management

Configuration management for the ACE library subsets described above will be organized as follows:

1. A single source tree with a single "version" for the source tree.

2. Releases of libACE and its "subsets" will be atomic, i.e., all or nothing.

### Classes in Each ACE Library Subset

Below, we describe the classes in each ACE library subset.

#### libACE_OS

This library contains the OS adaptation layer and its supporting classes. The classes in this library should not depend on any other ACE library subsets. All of the other libraries will depend on this library. The following classes are included in this library.

      Basic_Types
      Time_Value
      OS
      OS_Dirent
      OS_Memory
      OS_QoS
      OS_String
      OS_TLI
      OS_Errno
      Base_Thread_Adapter
      OS_Thread_Adapter
      OS_Log_Msg_Attributes
      Thread_Hook
      Sched_Params
      Handle_Set
      Copy_Disabled

#### libACE_Utils

This library contains the following ACE container classes and other miscellaneous classes.

      ACE
      Active_Map_Manager
      Arg_Shifter
      ARGV
      Argv_Type_Converter
      Capabilities
      Containers
      Configuration
      Configuration_Import_Export
      Dirent
      Dirent_Selector
      Dynamic
      Flag_Manip
      Framework_Component
      Functor
      Get_Opt
      Hash_Map_Manager
      Connection_Recycling_Strategy
      Hashable
      Notification_Strategy
      Recyclable
      Refcountable
      Handle_Ops
      Init_ACE
      Lib_Find
      Message_Block
      Method_Request
      Object_Manager
      Registry
      String_Base_Const
      SString
      Stats
      Sample_History

#### libACE_Logging

This library contains the various ACE logging and tracing classes.

      Dump
      Log_Msg
      Log_Msg_Callback
      Log_Msg_Backend
      Log_Msg_IPC
      Log_Msg_NT_Event_Log
      Log_Msg_UNIX_Syslog
      Log_Record
      Logging_Strategy
      Trace

#### libACE_Threads

This library contains the ACE thread/process management and synchronization classes.

      Activation_Queue
      Process
      Process_Manager
      Synch
      Synch_Options
      Process_Semaphore
      Process_Mutex
      RW_Process_Mutex
      File_Lock
      Thread
      Thread_Manager
      Thread_Adapter
      Thread_Exit
      Thread_Control
      Token

#### libACE_Demux

This library contains the ACE Reactor and its associated classes, including the ACE Connection components.

      Event_Handler
      FlReactor
      Msg_WFMO_Reactor
      POSIX_Proactor
      POSIX_CB_Proactor
      WIN32_Proactor
      Priority_Reactor
      Proactor
      Reactor
      Select_Reactor
      Select_Reactor_Base
      SUN_Proactor
      Dev_Poll_Reactor
      TP_Reactor
      TkReactor
      WFMO_Reactor
      XtReactor
      QtReactor

#### libACE_Connection

This library contains the ACE Connection components, i.e., Acceptor, Connector, and Svc_Handler.

      Asynch_IO
      Asynch_IO_Impl
      Asynch_Pseudo_Task
      POSIX_Asynch_IO
      WIN32_Asynch_IO

#### libACE_Sockets

This library contains the ACE C++ wrappers for sockets.

      Addr
      INET_Addr
      IPC_SAP
      LSOCK
      LSOCK_Acceptor
      LSOCK_CODgram
      LSOCK_Connector
      LSOCK_Dgram
      LSOCK_Stream
      SOCK
      SOCK_Acceptor
      SOCK_CODgram
      Sock_Connect
      SOCK_Connector
      SOCK_Dgram
      SOCK_Dgram_Bcast
      SOCK_Dgram_Mcast
      SOCK_IO
      SOCK_Stream

#### libACE_IPC

This library contains all the ACE C++ wrappers for the other types of IPC and FILE I/O other than sockets. This library will depend on the `libACE_Socket` library.

      ATM_Addr
      ATM_Acceptor
      ATM_Connector
      ATM_Params
      ATM_QoS
      ATM_Stream
      XTI_ATM_Mcast
      DEV
      DEV_Addr
      DEV_Connector
      DEV_IO
      FIFO
      FIFO_Recv
      FIFO_Recv_Msg
      FIFO_Send
      FIFO_Send_Msg
      FILE_Addr
      FILE
      FILE_Connector
      FILE_IO
      IO_SAP
      IOStream
      Pipe
      Signal
      SPIPE_Addr
      SPIPE
      SPIPE_Acceptor
      SPIPE_Connector
      SPIPE_Stream
      SV_Message
      SV_Message_Queue
      SV_Semaphore_Complex
      SV_Semaphore_Simple
      SV_Shared_Memory
      TLI
      TLI_Acceptor
      TLI_Connector
      TLI_Stream
      TTY_IO
      UNIX_Addr
      UPIPE_Acceptor
      UPIPE_Connector
      UPIPE_Stream
      MEM_Acceptor
      MEM_Addr
      MEM_Connector
      MEM_IO
      MEM_SAP
      MEM_Stream

#### libACE_Svcconf

This library contains the ACE C++ wrappers for the Service Configurator component.

      DLL
      DLL_Manager
      Dynamic_Service_Base
      Parse_Node
      Service_Config
      Service_Manager
      Service_Object
      Service_Repository
      Service_Types
      Service_Templates
      Shared_Object
      XML_Svc_Conf
      Svc_Conf_l
      Svc_Conf_y
      Svc_Conf_Lexer_Guard

#### libACE_Streams

This library contains the ACE Streams classes.

      CDR_Base
      CDR_Stream
      Codeset_IBM1047
      Message_Queue
      Reactor_Notification_Strategy
      Task

#### libACE_Memory

This library contains the ACE C++ wrappers for shared memory and memory-mapped files.

      Based_Pointer_Repository
      Malloc
      PI_Malloc
      Malloc_Allocator
      Malloc_Instantiations
      Mem_Map
      Memory_Pool
      Obchunk
      Obstack
      Read_Buffer
      Shared_Memory
      Shared_Memory_MM
      Shared_Memory_SV

#### libACE_Timer

This componenty contains the ACE C++ wrappers for the ACE timer classes.

      Basic_Stats
      High_Res_Timer
      Profile_Timer
      System_Time
      Time_Request_Reply
      Timeprobe
      Timer_Hash
      Timer_Heap
      Timer_List
      Timer_Queue
      Timer_Wheel

#### libACE_Token

This componenty contains the ACE C++ wrappers for Token classes.

      Local_Tokens
      Remote_Tokens
      Token_Collection
      Token_Invariants
      Token_Manager
      Token_Request_Reply

#### libACE_Codec

This component contains the ACE codec support:

      Codecs

#### libACE_Other

This component contains miscellaneous ACE C++ wrappers:

      Local_Name_Space
      Name_Proxy
      Name_Request_Reply
      Name_Space
      Naming_Context
      Registry_Name_Space
      Remote_Name_Space

### ACE Library Size Breakdown

Here is an example size breakdown, by ACE library component. It is for the ACE 5.0 libACE.a, statically built with these make flags:

        debug=0 optimize=1 static_libs_only=1 DEFFLAGS=-DACE_USE_RCSID=0

These options translate into:

(a) No debugging,
(b) Optimization is set to -O2,
(c) Static ACE and TAO libraries, and
(d) Use of RCS Ids is turned off.

To build an ACE static library, if shared libraries are the default, use `make static_libs_only=1`. If you're using recent versions of GNU GCC, you can use the -frepo option, which typically reduces the footprint by another 25 percent.

Platform | Component | Total | For TAO subset | OS | Utils | Logging | Threads | Demux | Con- nection | Sockets | IPC | Svcconf | Streams | Memory | Token | Other
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | ---
Linux (RedHat 6.0/Intel) egcs 2.91.66 | Size, bytes | 648727 | 515501 | 10937 | 118305 | 13544 | 59593 | 74629 | 49933 | 16084 | 34820 | 92192 | 18462 | 27002 | 71574 | 61652
Percentage of total size | 100 | 79.46 | 1.69 | 18.24 | 2.09 | 9.19 | 11.50 | 7.70 | 2.48 | 5.37 | 14.21 | 2.85 | 4.16 | 11.03 | 9.50
LynxOS 3.0.0 g++ 2.7-97r1 | Size, bytes | 582672 | 475216 | 25620 | 97220 | 11000 | 44192 | 71388 | 58100 | 13120 | 31572 | 77972 | 21468 | 23564 | 60832 | 46624
Percentage of total size | 100 | 81.56 | 4.40 | 16.69 | 1.89 | 7.58 | 12.25 | 9.97 | 2.25 | 5.42 | 13.38 | 3.68 | 4.04 | 10.44 | 8.00
SunOS5.7 egcs 2.91.60 | Size, bytes | 709543 | 570693 | 11877 | 115306 | 13721 | 63027 | 87962 | 68551 | 16917 | 42954 | 99839 | 21357 | 29182 | 75970 | 62880
Percentage of total size | 100 | 80.43 | 1.67 | 16.25 | 1.93 | 8.88 | 12.40 | 9.66 | 2.38 | 6.05 | 14.07 | 3.01 | 4.11 | 10.71 | 8.86
SunOS 5.7 GreenHills 1.8.9 | Size, bytes | 803651 | 653787 | 15800 | 146633 | 18544 | 69172 | 103584 | 60580 | 23084 | 52986 | 108200 | 21528 | 33676 | 79324 | 70540
Percentage of total size | 100 | 81.35 | 1.97 | 18.25 | 2.31 | 8.61 | 12.89 | 7.54 | 2.87 | 6.59 | 13.46 | 2.68 | 4.19 | 9.87 | 8.78
SunOS 5.7 Sun C++ 4.2 | Size, bytes | 626824 | 494501 | 15502 | 64929 | 15605 | 63364 | 106841 | 55013 | 19945 | 73584 | 46434 | 19685 | 25952 | 69843 | 62480
Percentage of total size | 100 | 78.89 | 2.47 | 10.36 | 2.49 | 10.11 | 17.04 | 8.78 | 3.18 | 11.74 | 7.41 | 3.14 | 4.14 | 11.14 | 9.97
VxWorks 5.3.1 GreenHills 1.8.8 | Size, bytes | 689564 | 542628 | 22252 | 145036 | 19664 | 63640 | 54296 | 980 | 22120 | 47468 | 117932 | 23220 | 27220 | 78900 | 68036
Percentage of total size | 100 | 78.69 | 3.23 | 21.03 | 2.85 | 9.23 | 7.87 | 0.14 | 3.21 | 6.88 | 17.10 | 3.37 | 3.95 | 11.44 | 9.87
VxWorks 5.3.1 g++ cygnus- 2.7.2-960126 (with implicit templates) | Size, bytes | 1051540 | 888244 | 36484 | 140832 | 14344 | 66740 | 266192 | 14480 | 15084 | 106308 | 142500 | 55932 | 29348 | 88564 | 74732
Percentage of total size | 100 | 84.47 | 3.47 | 13.39 | 1.36 | 6.35 | 25.31 | 1.38 | 1.43 | 10.11 | 13.55 | 5.32 | 2.79 | 8.42 | 7.11

> It has also been observed recently that using -xO3 with -xspace on SUN CC 5.3 compiler gives a big footprint reduction of the order of 40%

### Building ACE Subsets

By default, the ACE library contains all of the components that ACE currently supports. To reduce build time and library size, you can exclude unused components. To do that, define an `ACE_COMPONENTS` variable using this approach:

1. In your `$(ACE_ROOT)/include/makeinclude/platform_macros.GNU` file, e.g., add:

       ACE_COMPONENTS = OS

   or

2. On the make command line, e.g.,

       make ACE_COMPONENTS=OS

   or

3. Set (and export) the `ACE_COMPONENTS` environment variable to contain the components that you want to build.

Please see `../ace/Makefile` for the default contents of `ACE_COMPONENTS`.

A special value of `ACE_COMPONENTS` can be used to build an ACE library that supports TAO. The special value is `FOR_TAO`. So, for example, you can add this to your `$(ACE_ROOT)/include/makeinclude/platform_macros.GNU` to restrict ACE support to just that which is needed for TAO:

    ACE_COMPONENTS = FOR_TAO

Please note the current limitations:

1. We currently don't check for interdependencies between components. For example, if you build any component beside `OS`, you must explicitly include `OS` in your `ACE_COMPONENTS`.
2. We currently don't check this macro in other ACE or TAO Makefiles, or in their tests. We'll add those checks as time allows.
3. This is only supported by the gmake Makefiles. For example, the MSVC projects on Win32 do not support the specification of components.

### ACE_OS Adaptation Layer

The lowest-level component, `OS`, is also called the ACE_OS adaption layer. It provides the ACE interface to the underlying operating system, but little else. It can be used standalone.

To create the ACE_OS adaptation layer, build your `libACE` with `ACE_COMPONENTS` set to `OS`. In addition, add `#include "ace/config-minimal.h"` to your `ACE_wrappers/ace/config.h` file.

When using the ACE_OS adaptation layer, you'll be limited to the the `ACE_OS` member functions, ACE's Basic_Types and Sched_Params, and macros defined in `ace/OS.h`. See ACE's Basic_Types_Test.cpp for an example of usage.

Back to the ACE home page.
Back to ACE Documentation Home.