Loader

What is Loader?

A loader refers to the specific component that loads the necessary programs and libraries into the main memory of the computer to facilitate their execution, especially during the startup phase.

Technically, the loader is the component that reads the contents of the executable object codes generated by the compiler and assembler and performs the other necessary preparatory tasks to run them.

Understanding Loader

What is Loader

A loader in a computer memory is an important component that helps in starting any application by loading the program into the memory and preparing it for execution.

It is for this reason that the loader is typically located permanently in the memory of most of the operating systems. This helps in the faster loading of the programs.

Typically, every operating system that supports loading programs will use loaders. However, loaders may be absent in:

However, there are quite a few operating systems supporting virtual memory that may have the loader stored in a pageable area in the memory.

In such situations, the loader will not copy the object codes or the content of it to the memory.

Instead, it will simply inform the subsystem of the virtual memory that there is a mapping between the contents of the related executable file and the specific space of the memory assigned for containing the codes of the program running.

Read Also:  Write Back vs Write Through Cache: 12 Differences

This will actually help the virtual memory subsystem to know the following:

This means that:

Functions of Loader

The loader is a specific type of a system program located in the memory that accepts object codes from the language translators as input for a program and helps in preparing them for execution.

It typically coordinates the operating system to get the original loading address of a file and loads it into the memory.

The functions of the loader are typically performed in four steps such as allocation, linking, relocation, and loading, where specific operations are performed in each step, as mentioned below.

In the allocation stage, the loader performs the following functions:

In the linking stage, the functions performed by the loader include:

In the relocation stage, the loader performs these basic functions:

In the final loading stage, the functions performed by the loader are:

Read Also:  What is Office 365? Background, Uses, Pros & Cons

In addition to the above major functions, here are some other functions performed by the loader, depending on the type of operating system:

Types of Loaders

There are five major types of loaders that perform diverse sets of functions such as, Compile and Go Loader, Absolute Loader, Relocatable Loader Dynamic Run-time Loader, and Bootstrap Loader.

Advantages

Disadvantages

Read Also:  What is Direct Memory Access (DMA)? Function, Types & More

Loader Vs Linker

Conclusion

The loader is a useful component in the memory that accepts object codes generated by the compilers and assemblers and helps in executing them by bringing them to the main memory.

Situated after the linker, it is also responsible for setting up references that will further help the programs in their operation.