Question

In: Computer Science

Why would you choose to use dynamic (shared) library linkage compared to static? Identify at least...

Why would you choose to use dynamic (shared) library linkage compared to static? Identify at least two advantages of dynamic over static. Describe at least one case where static is preferable. If it “feels” like all the advantages of each have already been listed by your classmates, comment on other students’ postings indicating why you support their perspective.

Solutions

Expert Solution

To understand the various differences between static & dynamic library linkage and to elaborate their specific advantages & disadvantages, we could conclude the below points herewith :-

1) Static linking is the process of copying all library modules used in the program into the final executable image. This is performed by the linker and it is done as the last step of the compilation process. The linker combines library routines with the program code in order to resolve external references, and to generate an executable image suitable for loading into memory. When the program is loaded, the operating system places into memory a single file that contains the executable code and data. This statically linked file includes both the calling program and the called program.

While on the other hand, In dynamic linking the names of the external libraries (shared libraries) are placed in the final executable file while the actual linking takes place at run time when both executable file and libraries are placed in the memory. Dynamic linking lets several programs use a single copy of an executable module.

2) Static linking is performed by programs called linkers as the last step in compiling a program. Linkers are also called link editors.

While on the other hand, Dynamic linking is performed at run time by the operating system.

3) Statically linked files are significantly larger in size because external programs are built into the executable files.

While on the other hand, In dynamic linking only one copy of shared library is kept in memory. This significantly reduces the size of executable programs, thereby saving memory and disk space.

4) In static linking if any of the external programs has changed then they have to be recompiled and re-linked again else the changes won't reflect in existing executable file.

While on the other hand, In dynamic linking this is not the case and individual shared modules can be updated and recompiled. This is one of the greatest advantages dynamic linking offers.

5) Statically linked program takes constant load time every time it is loaded into the memory for execution.

While on the other hand, In dynamic linking load time might be reduced if the shared library code is already present in memory.

6) Programs that use statically-linked libraries are usually faster than those that use shared libraries.

While on the other hand, Programs that use shared libraries are usually slower than those that use statically-linked libraries.

7) In statically-linked programs, all code is contained in a single executable module. Therefore, they never run into compatibility issues.

While on the other hand, Dynamically linked programs are dependent on having a compatible library. If a library is changed (for example, a new compiler release may change a library), applications might have to be reworked to be made compatible with the new version of the library. If a library is removed from the system, programs using that library will no longer work.

A major disadvantage of Dynamic Library is that they take more time to load and get the program running because the linking occurs at run-time instead of during compilation. Since there will be no dynamic querying of symbols in static libraries, many software/application still use Static Library for better speed.


Related Solutions

Why would we choose a cDNA library over a genomic DNA library? In other words, what...
Why would we choose a cDNA library over a genomic DNA library? In other words, what is the difference between the two?
Dynamic logic is considered to be temporary storage compared to static logic; justify the statement. (3
Dynamic logic is considered to be temporary storage compared to static logic; justify the statement. (3
You are required to use C++ static or dynamic arrays of characters to store c-strings. You...
You are required to use C++ static or dynamic arrays of characters to store c-strings. You are NOT allowed to use any C++ string data type variable for any purpose. Moreover, you are allowed to add any include directive. You are not allowed to include string, cstdlib or math libraries. Also, you are not allowed to use any built-in functions of c-strings. can someone help with the third, fourth, and fifth functions? I tried many ways but i cannot figure...
You are required to use C++ static or dynamic arrays of characters to store c-strings. You...
You are required to use C++ static or dynamic arrays of characters to store c-strings. You are NOT allowed to use any C++ string data type variable for any purpose. Moreover, you are allowed to add any include directive. You are not allowed to include string, cstdlib or math libraries. Also, you are not allowed to use any built-in functions of c-strings. can someone help with the third, fourth, and fifth functions? I tried many ways but i cannot figure...
what is a synopsis that includes a type of dynamic or static stretch and why is...
what is a synopsis that includes a type of dynamic or static stretch and why is this a beneficial stretch?
choose a medical organization and describe at least three different ratios that you would use to...
choose a medical organization and describe at least three different ratios that you would use to asses its financial postion. Explain why you selected those three ratios and how the three ratios would be used to update the CEO on financial status of the organization.
Give at least three examples of when you would use ANOVA. Why would you use ANOVA...
Give at least three examples of when you would use ANOVA. Why would you use ANOVA as opposed to t-Tests to determine the mean differences? Which method do you feel is easier to comprehend?
When would you choose to use containers in Windows and when would you choose to use...
When would you choose to use containers in Windows and when would you choose to use containers in Linux? How are they different? How are they similar?
identify and discuss at least three (3) of the forces by which an organization would choose...
identify and discuss at least three (3) of the forces by which an organization would choose to adopt a front-back structure
Choose a publicly traded company, and identify the resources that you would use (besides the financial...
Choose a publicly traded company, and identify the resources that you would use (besides the financial statements) to analyze the financial position of this corporation for 2016-2017. Find at least two resources, other than the financial statements, that provide information regarding your chosen company. Prepare an overview (approximately 300 words) of what is revealed about the company by these resources, including any items that you find to be unusual about the company. Provide a link to each resource examined with...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT