written 8.4 years ago by
teamques10
★ 68k
|
•
modified 8.4 years ago
|
Loader
Loader Function: The loader performs the following functions:
1) Allocation
2) Linking
3) Relocation
4) Loading
Allocation:
- Allocates the space in the memory where the object program would be loaded for
Execution.
- It allocates the space for program in the memory, by calculating the size of the program. This activity is called allocation.
- In absolute loader allocation is done by the programmer and hence it is the duty of the programmer to ensure that the programs do not get overlap.
- In reloadable loader allocation is done by the loader hence the assembler must supply the loader the size of the program.
Linking:
- It links two or more object codes and provides the information needed to allow references between them.
- It resolves the symbolic references (code/data) between the object modules by assigning all the user subroutine and library subroutine addresses. This activity is called linking.
- In absolute loader linking is done by the programmer as the programmer is aware about the runtime address of the symbols.
- In relocatable loader, linking is done by the loader and hence the assembler must supply to the loader, the locations at which the loading is to be done.
Relocation:
- It modifies the object program by changing the certain instructions so that it can be loaded at different address from location originally specified.
- There are some address dependent locations in the program, such address constants must be adjusted according to allocated space, such activity done by loader is called relocation.
- In absolute Loader relocation is done by the assembler as the assembler is aware of the starting address of the program.
- In relocatable loader, relocation is done by the loader and hence assembler must supply to the loader the location at which relocation is to be done.
Loading:
- It brings the object program into the memory for execution.
- Finally it places all the machine instructions and data of corresponding programs and subroutines into the memory. Thus program now becomes ready for execution, this activity is called loading.
- In both the loaders (absolute, relocatable) Loading is done by the loader and hence the assembler must supply to the loader the object program.