Sunday, June 17, 2012

Library

Reasons for using library to structure program:

(1) share common functionality
(2) convenient upgrade rather than replacing multiple executables
(3) separate of interface and implementation
(4) improve start up time and memory footprint by loading what is needed
(5) dynamically replaceable
(6) different version for different platform

Calls to library have a higher overhead than normal call because:
(1) library call may be implemented using a table of jump addresses
(2) library and its data is usually placed into new TLB entries. Calls to library could trigger TLB misses
(3) lazy load overhead during run time
(4) use of position-independent code (address reference relative to current executing location) to allow sharing but also increase code length.

No comments: