Sie sind auf Seite 1von 4

LINKERS and LOADERS

A loader loads the programs into the main memory from the
storage device. The OS transparently calls the loader when
needed.
A loader is a program used by an operating system to load
programs from a secondary to main memory so as to be executed.

A linker links and combines objects generated by a compiler into


a single executable. A linker is also responsible to link and
combine all modules of a program if written separately.
Usually large applications are written into small modules and are
then compiled into object codes. A linker is a program that
combines these object modules to form an executable.
Linker and Loader are the utility programs that plays a major role
in the execution of a program. The Source code of a program
passes through compiler, assembler, linker, loader in the
respective order, before execution. On the one hand, where
the linker intakes the object codes generated by the assembler
and combine them to generate the executable module. On the
other hands, the loader loads this executable module to the main
memory for execution.

Key differences between Linker and Loader


1. The key difference between linker and loader is that the linker
generates the executable file of a program whereas, the loader
loads the executable file obtained from the linker into main memory
for execution.

2. The linker intakes the object module of a program generated by


the assembler. However, the loader intakes the executable
module generated by the linker.
3. The linker combines all object module of a program to
generateexecutable modules it also links the library function in
the object module to built-in libraries of the high-level
programming language. On the other hands, loader allocates space
to an executable module in main memory.

4. The linker can be classified as linkage editor, and dynamic linker


whereas loader can be classified as absolute loader, relocatable
loader and dynamic run-time loader.

5. Linker is a program that takes one or more objects generated by a


compiler and combines them into a single executable program.
6. Loader is the part of an operating system that is responsible for
loading programs from executables (i.e., executable files) into
memory, preparing them for execution and then executing them.

Relocation of Linking Concept


Program relocation is the process of modifying the addresses used in
the address sensitive instruction of a program such that the program
can execute correctly from the designated area of memory.

If linked origin≠ translated origin, relocation must be performed by


the linker.

If load origin≠ linked origin, relocation must be performed by the


loader.

Type of Loaders
The different types of loaders are, absolute loader, bootstrap loader,
relocating loader (relative loader), and, direct linking loader.

1.Absolute Loader

The operation of absolute loader is very simple. The object code is


loaded to specified locations in the memory. At the end the loader
jumps to the specified address to begin execution of the loaded
program. The advantage of absolute loader is simple and efficient. But
the disadvantages are, the need for programmer to specify the actual
address, and, difficult to use subroutine libraries.

2. A Simple Bootstrap Loader

When a computer is first turned on or restarted, a special type of


absolute loader, called bootstrap loader is executed. This bootstrap
loads the first program to be run by the computer -- usually an
operating system. The bootstrap itself begins at address 0. It loads the
OS starting address 0x80. No header record or control information,
the object code is consecutive bytes of memory.

3. Machine-Dependent Loader Features

Absolute loader is simple and efficient, but the scheme has potential
disadvantages One of the most disadvantage is the programmer has to
specify the actual starting address, from where the program to be
loaded. This does not create difficulty, if one program to run, but not
for several programs. Further it is difficult to use subroutine libraries
efficiently. This needs the design and implementation of a more
complex loader. The loader must provide program relocation and
linking, as well as simple loading functions.

4. Relocation

The concept of program relocation is, the execution of the object


program using any part of the available and sufficient memory. The
object program is loaded into memory wherever there is room for it.
The actual starting address of the object program is not known until
load time. Relocation provides the efficient sharing of the machine
with larger memory and when several independent programs are to
be run together. It also supports the use of subroutine libraries
efficiently. Loaders that allow for program relocation are called
relocating loaders or relative loaders.

Finite State Automata


Finite automata (FA), also widely known as finite state automata (FSA), are a
mathematical model of computation based on the ideas of
a. A system changing state due to inputs supplied to it.
b. Transitions from state to state are governed
c. Some of these states being acceptor or final states.

This is, as we will see, a computation model of somewhat limited power. Not all
things that we regard as “computation” can be done with FAs.

Das könnte Ihnen auch gefallen