Static Vs. Dynamic Loading in Operating System (OS)
The operating system loads a library of function during processing different programs. Files are brought into the memory which are needed as the processing of the programs takes place. Generally, the loading process is divided into two categories, static and dynamic loading. The process can vary depending on the loading method where the loading can take place at once, or at random time. In the case of static loading, the load process doesn’t change over time, on the other hand, in the case of dynamic loading, it changes with time.
The selection between static and dynamic loading is made by the developer who develops the operating system. The following table represents the difference between the static and the dynamic loading.
|Static Loading||Dynamic Loading|
|The complete program is linked and complied without dependency of an external program.||All the modules are loaded dynamically. The developer provides a reference to all of them and the rest of the work is done at execution time.|
|Absolute data and program are loaded into the memory to start execution.||Loading of data and information takes bit by bit in run time.|
|The linker combines the object program with other object modules to make a a single program.||The linking process takes place dynamically in relocatable form. Data is loaded into the memory only when it is needed in the program.|
|The processing speed is faster as no files are updated during the processing time.||The processing speed is slower as files are uploaded at the time of processing.|
|The code may or may not be executed once it is loaded into the memory||Execution takes place only when it is required.|
|Static loading is done only in the case of structured programming languages such as C.||Dynamic loading takes place in the case of object-oriented programming languages such as C++, Java, etc.|
|The primary drawback is the wastage of memory since, once the code is loaded, it might or might not be executed.||The primary benefit of dynamic loading is efficient memory utilization.|
The decision of choosing the static or the dynamic loading method also depends on the size of the program. For instance, if the program is too big, its modules should be selected and loaded into the main memory as per the requirements using the dynamic loading method. On the other hand, static loading is the best option when the programs are smaller in size.
Learn about static vs. dynamic linking here.
- Memory Management Introduction
- Partition Allocation Method
- Buddy- System Allocator
- Types of Paging
- Mapping Virtual address to Physical Address.
- Virtual Memory
- Demand Paging
- Implementation of Demand paging and page fault
- Page Replacement Algorithms
- Belady’s Anomaly
- Static vs Dynamic Loading
- Static vs Dynamic Linking
- Translational Look Aside Buffer
- Process Address Space
- Difference between Segmentation and Paging