Minimize paging activity
Although processes that use dynamically linked libraries
do not write to shared pages,
they still may incur page faults.
To the extent they do, their performance degrades.
You can minimize paging activity in the following ways:
Organize to improve locality of reference.
Exclude infrequently used routines
on which the library itself does not depend.
Traditional a.out files contain all the code
they need at run time.
So if a process calls a function, it
may already be in memory because of its proximity
to other text in the process.
If the function is in a dynamically linked library, however,
the surrounding library code may be unrelated
to the calling process.
Only rarely, for example, does any single
executable use everything in the dynamically linked C library.
If a dynamically linked library has unrelated functions, and
if unrelated processes make random calls
to those functions, locality of reference may be decreased,
leading to more paging activity.
The point is that functions used by only
a few a.out files do not save much
disk space by being in a dynamically linked library,
and can degrade performance.
Try to improve locality of reference by grouping
dynamically related functions.
If every call to funcA() generates calls
to funcB() and funcC(), try to
put them in the same page.
generates this type of static dependency information.
Combine it with profiling to see what things
actually are called, as opposed to what things
might be called.
Align for paging.
Try to arrange object files in the dynamically linked
so that frequently used functions do not unnecessarily
cross page boundaries.
First, determine where the page boundaries fall.
You can use the
to determine how symbol values relate to page boundaries.
After grouping related functions, break them up into page-sized chunks.
Although some object files and functions are larger than
a page, many are not.
Then use the less frequently called functions
as glue between the chunks.
Because the glue between pages is referenced less
frequently than the page contents, the probability
of a page fault is decreased.
You can put frequently used, unrelated functions
together because they will probably be called
randomly enough to keep the pages in memory.
Avoid hardware thrashing.
Minimize the library's data segment
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003