The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+19 votes
2.3k views

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

asked in Compiler Design by Veteran (69k points) | 2.3k views
and what about the draw back of static linked libraries

3 Answers

+38 votes
Best answer

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).

Reffer :From galvin 

 

answered by Active (1.6k points)
edited by
Why is B) wrong?
it is true
So what is the final  answer ? b or c?
though during mid of execution static linking will be faster because everything is already linked, so no kernal involvement, no system calls, no unnecessary overheads, but during startup DLL should be faster than static linking, because there will be less overhead to link everything at startup..and program can start without linking everything..
so,you are suggesting b as answer?
+13 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

answered by Active (1.1k points)
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.

 

yes, option (b) seems to be incorrect.

 

and also (a)smaller sizes of executables; supports the fact that (b) faster program startup
+11 votes
More Page faults in dynamic linked libraries so solution is "B"
answered by Junior (791 points)


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

33,593 questions
40,128 answers
114,021 comments
38,389 users