The kar library archive utility
The IBM Power architecture uses a simple MMU that is very fast. However it has the limitation that there is a fixed mapping between real and virtual pages in memory that limits the usefulness of memory mapped shared libraries in KCML. The AIX Operating System works around this limitation in 32 bit applications by reloading the page maps on context switches but the resulting page faults impose a stiff performance penalty that grows linearly with the number of users.
To avoid this overhead on AIX 5 (or later), KCML offers an alternative mechanism for shared libraries that can preload an archive containing a number of libraries into a fixed, dedicated memory segment that is mapped at the same address for all users thus avoiding the MMU reloading penalty. At most 11 such 256MB segments are available, numbered 3 to 14 with segment 13 reserved for AIX's own dynamic library mechanism. In practice segment 3 and possibly 4 will also be in use. KCML by default will use segment 14.
To use this facility the libraries are archived together into a single file using KCML's kar utility. E.g.
kar -o bundle.kar -c *.kbin
When the AIX version of KCML starts up it will check for the existence of the environment variable KCML_KAR_BUNDLE and, if found, it will assume it contains the location of the archive and it will load it into memory at the address stored in the archive header (segment 14 or 0xE0000000 by default). When a LIBRARY ADD statement is executed KCML will then first check if the library can be found in the mapped segment before attempting to map it in using the conventional mechanism with its performance penalty. If it can find it in the segment then it will connect up the library to use the faster bundle.
The archive utility has the following command line switches:
Switch | Purpose |
---|---|
-b base | Drop common base directories from files in the index |
-c | Clip all directories from files in the index |
-f file | Take library filenames from this file. If the filename is '-' then pipe from standard input. |
-h | Print header information for tha archive (with -t only). |
-o bundle | Create an archive bundle with the given name. If the name is '-' or neither -o nor -t appears then pipe to standard output. |
-s | Silent mode. No warnings sent to standard error. |
-t bundle | Test mode. Print contents of the index for the given archive. |
-v | Echo library names to standard output as they are archived |
-x segment | Map into a specific segment (4-12 or 14 with 0 for default). |
It operates in two distinct modes with mutually exclusive switches:
Exit codes
Any problems will be reported to standard error stream and the utility will halt with a non-zero exit code.
Compatibility
This was introduced with KCML 7.02 but subsequently retrofitted to 6.20 & 6.90.
It is only available for 32 bit versions of KCML built for AIX 5 or later.