16,188 views
51 votes
51 votes

Which of the following is NOT an advantage of using shared, dynamically linked libraries as opposed to using statistically linked libraries?

  1. Smaller sizes of executable files

  2. Lesser overall page fault rate in the system

  3. Faster program startup

  4. Existing programs need not be re-linked to take advantage of newer versions of libraries

4 Answers

Best answer
79 votes
79 votes

option C: DLL takes more time in program setup (in loading and linking phase to set up the global offset table and load and link the required libraries)

  • Since DLLs are separated from executable, the size of executable becomes smaller. Since DLLs are shared among multiple executables, the total memory usage of the system goes down and hence overall page fault rate decreases.
  • Dynamic linking takes place during program runtime. So, if a DLL is replaced to a new version, it will automatically get linked during runtime. There is no explicit relinking required as in the case of static linking. (This works by linking the DLL calls to Global Offset Table and the contents of this table is filled during program run. A simple jump in static linking becomes an indirect jump in dynamic linking).

Refer: Galvin section 8.1.5, Dynamic Linking and Shared Libraries

edited by
32 votes
32 votes

The shared library code is not present in the executable image on disk, but is kept in a separate library file. So size of executable file is smaller.

Operating system is less likely to page out shared library code that is being used by several applications, or copies of an application, rather than code that is only being used by a single application. This causes less page fault. 

But sometimes you may be interested in only a few of the routines in a library, and these routines may be scattered widely in the virtual address space of the library. Thus, the total number of pages you need to touch to access all of your routines is significantly higher than if these routines were all bound directly into your executable program. One impact of this situation is that, if you are the only user of these routines, you experience more page faults to get them all into real memory.

Faster program startup as load time might be reduced because the shared library code might already be in memory.

The routines are not statically bound to the application but are dynamically bound when the application is loaded. This permits applications to automatically inherit changes to the shared libraries, without recompiling or rebinding.

So option A, C and D are always the advantage of the shared DLL. Only option B is not always an advantage.

Reference: http://www.ibm.com/support/knowledgecenter/ssw_aix_72/com.ibm.aix.performance/when_dyn_linking_static_linking.htm

17 votes
17 votes
More Page faults in dynamic linked libraries so solution is "B"
0 votes
0 votes
I dont know about C but B is true.

As in dynamic linked libraries only required files are called upon so locality of reference reduces . The routines that are called may be spread across the virtual address so more number of pages are required to access itso more page fault is there.
Answer:

Related questions

26 votes
26 votes
4 answers
3
67 votes
67 votes
10 answers
4
Kathleen asked Sep 16, 2014
26,978 views
Which of the following suffices to convert an arbitrary CFG to an LL(1) grammar?Removing left recursion aloneFactoring the grammar aloneRemoving left recursion and factor...