Wednesday, May 22, 2013
In this article we shall discuss about three interrelated concepts namely address binding, dynamic loading and dynamic linking.
1. Address Binding:
- There are two types of addresses for the computer memory.
- These are called the physical address and the logical address.
- A physical memory location is allocated to a logical pointer by address binding process.
- This is actually nothing but associating the physical address and the logical address with each other.
- Sometimes logical address is also referred to as the virtual address.
- This concept is an important part of the memory management.
- Operating system is responsible for carrying out address binding on behalf of the applications and programs that need an access to the memory.
- A program cannot be executed without bringing it to the main memory.
- The instructions of the program have to be bound to right address spaces in the physical memory.
- Address binding is simply a scheme for performing this job.
- It can be thought of as something similar to address mapping.
- Address binding can be carried out at any of the following times:
Ø Compile time
Ø Loading time
Ø Execution time
- In execution time binding, whenever the program requires access to memory, it has to go through a register called the relocation register and is similar to the base register.
- Then the offset is added.
- But in binding during the loading time, same thing is done but every time this register need not be evaluated.
- The addresses are mapped at the time of loading the program in to the memory.
- If there is a change in the base address, the whole program has to be reloaded.
2. Dynamic Loading:
- This mechanism is very useful for a program as it helps it do the following things:
Ø Loading library in to the main memory.
Ø Retrieving the address of the variables and routines that are contained in the library.
Ø Accessing those variables and executing those routines.
Ø Unloading the library.
- Dynamic loading is very much different from the load time linking and static linking.
- Dynamic loading allows a system to start up even of the libraries are absent. - It also helps in discovering the absent libraries and then gaining the additional functionality.
- Dynamic loading is a very transparent process since it is the operating system that handles it.
- Main advantages are firstly, it helps in fixing the patches at once without having the need for re-linking them and secondly, it provides protection to the libraries against modification that is not authorized.
- Dynamic loading find its major use in the implementation of the software plugins.
- It is also used in the implementation of the computer programs where requisite functionality is supplied by the different libraries and user has the freedom to select the libraries he/ she wishes to provide.
3. Dynamic Linking:
- This is an important part of the binding process.
- The purpose of the dynamic linking is resolving the references or symbols and links to the library modules.
- This process is carried out by a linker program.
- This programs searches for a set of library modules in some given sequence.
- This process takes place during the creation of the executable file.
- The resolved references may be addresses of the jump calls and the routines. - These may in different modules or in the main program.
- Dynamic linking resolves them in to relocatable address or fixed address through allocation of the memory to each of the memory segment of the referenced module.