You are on page 1of 7

SANT LONGOWAL INSTITUTE OF

ENGINEERING AND TECHNOLOGY

Assignment:1
Department of computer science.
Subject - System programming
SUBMITTED BY: SUBMITTED TO:
NAME: KABITA KUMARI NAME: ASHU Mam
REG.NO: 1712889 ASSISTANT PROF OF CSE

TEACHER SIGN:-
________________
Q1. Define loader and its function?
LOADER: A loader is a system program, which takes the object code of a program as input and prepares
it for execution. Programmers usually define the Program to be loaded at some predefined location in the
memory. But this loading address given by the programmer is not be coordinated with the OS. The loader
does the job of coordinating with the OS to get initial loading address for the .EXE file and load it into the
memory.
DIAGRAM:

Loader Function: The loader performs the following functions:


 Allocation
 Linking
 Relocation
 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.

Q2. Discuss the compile and go loader schema with its merits and demerits?
COMPILE AND GO LODER: In this type of loader, the instruction is read line by line, its machine
code is obtained and it is directly put in the main memory at some known address. That means the
assembler runs in one part of memory and the assembled machine instructions and data is directly put into
their assigned memory locations. After completion, the assembly process assigns the starting address of
the program to the location counter. The typical example ie WATFUR-77, a FORTRAN compiler which
uses such "load and go" scheme. This loading scheme is also called as "assemble and go".
Fig: compile and g loader

ADVANTAGES:
 This scheme is simple to implement because assembler is placed at one part of the memory and
loader simply loads assembled machine instructions into the memory.
DISADVANTAGES:
 In this scheme, some portion of memory is occupied by assembler which is simply a wastage of a
memory. As this scheme is a combination of assembler and loader activities this combination
program occupies a large block of memory.
 There is no production of .obj file, the source code is directly converted to executable form.
Hence even though there is no modification in the source program it needs to be assembled and
executed each time which then become a time-consuming activity.
 It cannot handle multiple source program or multiple programs written in different languages.
This is because assembler can translate one source language to another target language.
 The execution time will be more in this scheme as every time program is assembled and then
executed.
Q3. Discuss the absolute loader scheme with its merits and demerits?
ABSOLUTE LOADER: The absolute loader is a kind of loader in which relocated object files are
created, loader accepts these files and places them at a specified location in the memory. This type of
loader is called absolute loader because no relocating information is needed, rather it is obtained from the
programmer or assembler. The starting address of every module is known to the programmer, this
corresponding starting address is stored in the object file then the task of loader becomes very simple that
is to simply place the executable form of the machine instructions at the locations mentioned in the object
file. In this scheme, the programmer or assembler should have knowledge of memory management. The
programmer should take care of two things: Specification of starting address of each module to be used. If
some modification is done in some module then the length of that module may vary. This causes a change
in the starting address of immediate next modules, it's then the programmer's duty to make necessary
changes in the starting address of respective modules. While branching from one segment to another the
absolute starting address of respective module is to be known by the programmer so that such address can
be specified at respective JMP instruction.

Fig: Process of absolute loader


ADVANTAGES:
 It is simple to implement.
 This scheme allows multiple programs or the source programs written in different languages. If
there are multiple programs written in different languages then the respective language assembler
will convert it to the language and common object file can be prepared with all the ad resolution.
 The task of loader becomes simpler as it simply obeys the instruction regarding where to place
the object code to the main memory.
 The process of execution is efficient.
DISADVANTAGES:
 In this scheme, it's the programmer's duty to adjust all the inter-segment addresses and manually
do the linking activity. For that, it is necessary for a programmer to know the memory
management.
 If at all any modification is done to some segment the starting address of immediate next
segments may get changed the programmer has to take care of this issue and he/she needs to
update the corresponding starting address on any modification in the source.
Q4. Discuss the relocating loader scheme with its merits and demerits?
GENERAL LOADER SCHEME/ RELOCATING LOADER SCHEME: In this loader scheme, the
source program is converted to object program by some translator (assembler). The loader accepts these
object modules and puts the machine instruction and data in an executable form at their assigned memory.
The loader occupies the same portion of main memory.

Fig. relocating loader scheme

ADVANTAGES:
 The program need not be retranslated each time while running it. Thus us because initially when
source program gets executed and object program gets generated. If a program is not modified,
then the loader can make use of this object program to convert it to executable form.
 There is no wastage of memory because the assembler is not placed in the memory instead of it,
loader occupies some portion of the memory. And the size of the loader is smaller than assembler
so more memory is available to the user.
 It is possible to write source program with multiple programs and multiple languages because the
source program is first converted to an object program always and loader accepts these object
modules to convert it to an executable format.
DISADVANTAGE:
 The programmer has to identify to assembler to load the program.
 The programmer has to keep in mind the address of the sub-routines to be used in the subroutines
linkage.

Q5. Discuss the direct linking loader scheme with its merits and demerits?
DIRECT LINKING: Direct Linking is when a Publisher creates sponsored PPC ads that link directly to
an Advertiser’s site. If Direct Linking is restricted, Publishers can use their own domain or site and create
their own landing page that they send visitors to first, before sending them to the Advertiser's site.
ADVANTAGES:
 The conversion rate is usually higher as a result of Direct Linking
 Better customer journey as there is no need for a landing page
 Can lead to a higher rank in Google
DISADVANTAGES:
 Allowing Direct Linking can lead to less control over your brand
 Can potentially conflict with an Advertiser's own campaign, as there can only be one ad per URL
per search term. This could result in an Advertiser’s own ad being removed if Google deem a
Publisher’s ad to be better.

You might also like