Linker and Loader

 Differentiate between Linker and Loader.


1. Linker:

   - Function: The primary function of a linker is to generate executable files.

   - Input: - It takes input in the form of object code generated by the compiler or assembler.

   - Definition:- Linking is the process of combining various pieces of code and source code to obtain an executable code.

   -Tasks Performed by Linker:

Symbol resolution: The linker resolves symbols defined in one module and referenced in another.

Code optimization: It optimizes the code generated by the compiler to reduce size and improve performance.

Memory management: It assigns memory addresses to code and data sections, resolving conflicts.

Library management: Linkers can link external libraries into the executable file for additional functionality.

Types of Linkers:  -Linkage Editor and Dynamic Linker.


2. Loader:

 -Function: The main objective of a loader is to load executable files into main memory and prepare them for execution.

-Input:- It takes input in the form of executable files generated by the linker.

-Definition: - Loading is the process of loading executable code into main memory for further execution.

-Tasks Performed by Loader:

      -Loading: It loads the executable file into memory and allocates memory for the program.

      -Relocation: The loader adjusts memory addresses to reflect the program's location.

      -Symbol resolution: It resolves unresolved external symbols required by the program.

      -Dynamic linking: Loaders can dynamically link libraries at runtime for additional functionality.

  Types of Loaders:

      - Absolute Loaders

      - Relocating Loaders

      - Direct Linking Loaders

      - Bootstrap Loaders

In summary, linkers generate executable files by combining object modules, while loaders load these executables into memory for execution by the computer's processor.

KRISHNA

Author & Editor

Thanks for visiting xmonocodes , i hope you are getting everything you want.

0 comments:

Post a Comment