Software Development in the UNIX Environment
Libraries
Two Kinds of Object Libraries:
-
static - linked
into the executable image (ex libc.a)
-
dynamic shared objects (DSO) -The
object modules are bound into the executable at runtime (ex libc.so)
Advantages of DSOs:
-
Possibly smaller process memory utilization
A shared library module is bound into system memory when the first
running program references it. If any subsequent running program
references
it, that reference is mapped to this first copy.
-
Easier to update
Installing an updated dynamic library on a system immediately
affects all the applications that use it without requiring relinking
of the executable.
-
Smaller executable files
Deferring binding of the library routines until execution time means
that the size of the executable
file is less than the equivalent executable calling a static version
of the library; the executable file
does not contain the binaries for the library routines.
Disadvantages of DSOs:
-
Possibly increased overhead
Additional processor time is needed to load and link-edit the library
routines during runtime.
Also, the library's position-independent coding may execute more
slowly than the relocatable
coding in a static library.
-
Less Portable Code
Shared libraries must be ported along with the executable if they are
not available on the system to
which code is being ported.
-
Slight Performance Impact
Usually around 5%.