gotchaMinor
Difference between dynamic loading and dynamic linking in the OS
Viewed 0 times
linkingthedifferencebetweenloadingdynamicand
Problem
First of all, I saw many answers of this topic in Quora, Stackoverflow, and this site. But, I couldn't definitely understand the difference between dynamic loading and dynamic linking.
What I understood until now is this.
Dynamic loading : system library or other routine is loaded during run-time and it is not supported by OS.
Dynamic linking : system library or other routine is linked during run-time and it is supported by OS.
What I'm confusing is the behaviour of this two concepts. I know that loading occurs after linking like below image. (from Operating System concepts 9th edition, Chapter 8 figure 8.3)
Then, my question is that does dynamic loading is occured after dynamic linking? If I'm wrong, what is the exact difference between two concepts?
What I understood until now is this.
Dynamic loading : system library or other routine is loaded during run-time and it is not supported by OS.
Dynamic linking : system library or other routine is linked during run-time and it is supported by OS.
What I'm confusing is the behaviour of this two concepts. I know that loading occurs after linking like below image. (from Operating System concepts 9th edition, Chapter 8 figure 8.3)
Then, my question is that does dynamic loading is occured after dynamic linking? If I'm wrong, what is the exact difference between two concepts?
Solution
Let me explain these terms in the simplest way possible. Now since both the terms have the word dynamic in them, both occur during execution.
Dynamic Loading : Suppose our program that is to be executed consist of various modules. Of course its not wise to load all the modules into main memory together at once(in some cases it might not be even possible because of limited main memory). So basically what we do here is we load the main module first and then during execution we load some other module only when its required and the execution cannot proceed further without loading it.
Dynamic Linking : Suppose our program has some functions whose definition is present in some system library. We do know the header file only consists of declarations of functions and not definitions. So during execution when the function gets called we load that system library into main memory and link the function call inside our program with the function definition inside system library.
Dynamic Loading : Suppose our program that is to be executed consist of various modules. Of course its not wise to load all the modules into main memory together at once(in some cases it might not be even possible because of limited main memory). So basically what we do here is we load the main module first and then during execution we load some other module only when its required and the execution cannot proceed further without loading it.
Dynamic Linking : Suppose our program has some functions whose definition is present in some system library. We do know the header file only consists of declarations of functions and not definitions. So during execution when the function gets called we load that system library into main memory and link the function call inside our program with the function definition inside system library.
Context
StackExchange Computer Science Q#92484, answer score: 2
Revisions (0)
No revisions yet.