Linkers, Loaders & Executables
What is an advantage of dynamic linking (shared libraries)?
- AIt always runs even if the library is missing from the system
- BSeveral programs can share one library in memory, and updating the library applies fixes without rebuilding
- CNo start-up work is needed, so it always starts faster than static linking
Show answer and explanation
Answer: B. Several programs can share one library in memory, and updating the library applies fixes without rebuilding
With dynamic linking, the executable records only which functions of which shared libraries it uses, and at run time the dynamic linker loads the libraries and binds them. Shared library code is never modified, so one copy in physical memory can be shared by many processes. Fixing a bug or vulnerability just means replacing the library. Binding does, however, add work at start-up.
- A. It cannot start if the library is not found.
- B. Correct. It also saves memory and disk space.
- C. Binding work is needed at start-up.