in Compiler Design
13,584 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

in Compiler Design
13.6k views

4 Comments

@tusharp 

@Shubhgupta

Other advantages of shared libraries are as follows

:Load time might be reduced because the shared library code might already be in memory.

as given in above link

So faster program startup should be an advantage of DLL right?

​​

1
1
yes
0
0

i found dynamic loading and dynamic linking videos quite useful

5
5

4 Answers

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

Refer: Galvin section 8.1.5, Dynamic Linking and Shared Libraries

edited by

4 Comments

For only that process there will be one page fault but once you load that module it’ll be available for other processes as well so it’ll reduce the overall page faults.
1
1
edited by

What is the final answer B or C ?

As per my current understanding, in case of DLL faster program startup (As program size is less. So, linker and loader will be faster compare to static LL). At run time for DLL slow as it will take some time to load dynamic library.

Means answer should be ‘B’ ?

@Arjun Sir

I feel @rahul sharma 5 ‘s above comment is correct.

0
0

https://www.ibm.com/docs/en/aix/7.2?topic=techniques-when-use-dynamic-linking-static-linking

 

According to this IBM documentation, Dynamic Linking results in more number of Page Faults

Answer B

0
0
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

1 comment

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
0
0
17 votes
17 votes
More Page faults in dynamic linked libraries so solution is "B"

1 comment

For only that process there will be some page faults but once you load that module it’ll be available for other processes as well so it’ll reduce the overall page faults, that’s why B is Incorrect.
0
0
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