You are on page 1of 1

LOADERS Aryan Tiwari 1BY19AI010

In computer systems a loader is the part of an operating system that is responsible for loading programs and libraries. It is one of the essential stages in the process of starting a pro-
gram, as it places programs into memory and prepares them for execution. Loading a program involves reading the contents of the executable file containing the program instructions into
memory, and then carrying out other required preparatory tasks to prepare the executable for running. Once loading is complete, the operating system starts the program by passing con-
trol to the loaded program code.
Types of Loaders:
1. Compile & go Loader
2. Absolute Loader
3. Relocating Loader
4. Direct Linking Loader

COMPILE AND GO LOADER: CompilerA Assembler


RELOCATING LOADER:
Compile and go loader is a link editor/program loader in which To avoid possible reassembling of all subroutines when a single
Source Program Pre-Processed Assembly
the assembler itself places the assembled instruction directly into Code
Object Code subroutine is changed and to perform the tasks of allocation and
source code
the designated memory locations for execution. The instruction linking for the programmer, the relocating loaders is used, e.g.
are read line by line, its machine code is obtained and it is direct- Pre-processor BINARY SYMBOLIC SUBROUTINE(BSS)loader such as used in
Linker
ly put in the main memory at some known address.After comple- the IBM 7094, IBM 1130, GE 635. The BSS loader allows many
tion of assembly process, it assigns the starting address of the procedure segments but only one data (common)segment.
program to the location counter.The assembler is first executed Executable Code
and it, when it is finished, causes a branch straight to the first in- The assembler assembles each procedures segment inde-
struction of the program.There is no stop between the compila- pendently and passes to loader the text and information as to
tion, link editing,loading, and execution of the program. It is also relocation and intersegment references. The output of the relo-
called an assemble-and-go or a load-and-go system. Process cating assembler using a BSS scheme is the Object program
Address Porgram stored in
and information about all other program its references. For each
Space secondary memory
Advantages: LOADER as executable image
program the assembler outputs a text(machine translation of the
- They are simple and easier to implement. program)
- No additional routines are required to load the compiled code
Main Memory
into the memory. Disadvantage:
Considerable overhead & complexity because loading & linking
Disadvantages: is postponed until execution time.
- There is wastage in memory space due to the presence of the as
sembler. How Does the Loader Get Loaded ?
- There is no production of .objfile, the source code is directly convert
ed to executable form. Hence even though there is no modification
in the source program it needs to be assembled and executed Answer: Bootstrap Loader.
each time.
Alternatively referred to as bootstrapping, bootloader, or boot program,
a bootstrap loader is a program that resides in the computer’s EPROM,
ROM, or another non-volatile memory. It is automatically executed by
ABSOLUTE LOADER: the processor when turning on the computer. The bootstrap loader
DIRECT LINKING LOADER:
In this scheme the assembler outputs the machine language A direct-linking loader is a relocatable loader and is the most
reads the hard drives boot sector to continue to load the computer’s op-
translation of the source program in almost the same form as in popular loading scheme presently used.
erating system.
the “Compile and go” , except that the data is punched on cards. It has advantage of allowing programmer multiple procedure
Here it will directly placed in memory .The loader in turn simply segments and multiple data segments. Complete freedom in
accepts the machine language text and places it into core at the referencing data or instructions contained in other segments,
location prescribed by the assembler. provides flexible intersegment referencing.
There are four functions involving in the Absolute loading: Alloca- first.obj first.exe execution
first.c
tion, Linking, Relocation and Loading. Compiler Linker Loader Advantages:
source object - It allows the programmer to use multiple procedures and mul-
file tiple data segments.
Disadvantages: file
- The programmer must specify to the assembler the address - In addition, the programmer is free to reference data or in-
where the program is to be loaded. structions that are contained in other segments.
- If there are multiple subroutines , the programmer must remem - They provide flexible intersegment referencing and accessing
Library Functions
ber the address of each. ability.

LOAD SEQUENCE

You might also like