loaders ( system programming )

24
Organization name :: Prepared By :: Adarsh Patel :: Submit To :: Prof. xyz Types of Loaders

Upload: adarsh-patel

Post on 12-Apr-2017

357 views

Category:

Engineering


5 download

TRANSCRIPT

Page 1: Loaders ( system programming )

O r g a n i z a ti o n n a m e

:: Prepared By ::Adarsh Patel

:: Submit To ::Prof. xyz

Types of Loaders

Page 2: Loaders ( system programming )

Loaders 2

OverviewIntroduction of LoaderCompile-Go LoaderGeneral LoaderAbsolute LoaderRelocating LoaderPractical Relocating LoaderLinking LoaderLinker Vs. Loader

Reference :: -System Programming by Srimanta Pal OXFORD Publication -web.thu.edu.tw/ctyang/www/files/sp_chap3

Page 3: Loaders ( system programming )

Loaders 3

Source Program

Pre-processed source code

Assembly code Object code

Executable code

Program stored in secondary memory as executable image

Process Address Space

Main Memory

Loader

Pre-processor

Compiler Assembler

Linker

C Program Building Process

Page 4: Loaders ( system programming )

Loaders 4

A loader is a system software program that performs the loading function.

Loading is the process of placing the program into memory for execution.

Loader is responsible for initiating the execution of the process.

Loaders

Page 5: Loaders ( system programming )

Loaders 5

Compile-Go Loader

General Loader

Absolute Loader

Relocating Loader

Practical Relocating Loader

Linking Loader

Types of Loaders

Page 6: Loaders ( system programming )

Loaders 6

In compile and go loader is a link editor/program loader in which the assembler itself places the assembled instruction directly into the designated memory locations for execution.

The instruction are read line by line, its machine code is obtained and it is directly put in the main memory at some known address.

After completion of assembly process, it assigns the starting address of the program to the location counter.

Compile and go Loaders

Page 7: Loaders ( system programming )

Loaders 7

The assembler is first executed and it, when it is finished, causes a branch straight to the first instruction of the program.

There is no stop between the compilation, link editing, loading, and execution of the program.

It is also called an assemble-and-go or a load-and-go system.

Cont.

Page 8: Loaders ( system programming )

Loaders 8

They are simple and easier to implement. No additional routines are required to load the compiled code

into the memory.

Cont.:: Advantages ::

Page 9: Loaders ( system programming )

Loaders 9

There is wastage in memory space due to the presence of the assembler.

There is no production of object 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.

Cont.:: Disadvantages ::

Page 10: Loaders ( system programming )

Loaders 10

In Compile-and-Go the outputting instruction and data are assembled. In which assembler is placed in main memory that results in wastage of memory.

To overcome that we requires the addition of the new program of the system, a loader.

Generally the size of loader is less than that of assembler.

General Loaders

Page 11: Loaders ( system programming )

Loaders 11

Reassembly of program is not needed The translator of the source program produce compatible

object program files More memory is available to the user

Cont.:: Advantages ::

The loader cannot handle different object Module Obtained from different kinds of computers

:: Disadvantages ::

Page 12: Loaders ( system programming )

Loaders 12

In this scheme the assembler outputs the machine language translation of the source program in almost the same form as in the “Compile and go” , except that the data is punched on cards. Here it will directly placed in memory .

The loader in turn simply accepts the machine language text and places it into core at the location prescribed by the assembler.

Absolute Loaders

Page 13: Loaders ( system programming )

Loaders 13

The MAIN program is assigned to locations 100-247 and the SQRT subroutine is assigned locations 400-477. if changes were made to MAIN that increasing length to more than 300 bytes.

Cont.

MAIN

SQRT

Absoluteloader

SQRT

MAIN

Page 14: Loaders ( system programming )

Loaders 14

The end of MAIN is overlap with the start of SQRT. It would then necessary to assign SQRT to a new location by changing its START.

There are four functions involving in the Absolute loading• Allocation• Linking• Relocation• Loading

Cont.

Page 15: Loaders ( system programming )

Loaders 15

Simple and efficient.

Cont.:: Advantages ::

The programmer must specify to the assembler the address where the program is to be loaded.

If there are multiple subroutines , the programmer must remember the address of each.

:: Disadvantages ::

Page 16: Loaders ( system programming )

Loaders 16

To avoid possible reassembling of all subroutines when a single subroutine is changed and to perform the tasks of allocation and linking for the programmer the relocating loaders is introduced.

The execution of the object program is done using any part of the available & sufficient memory.

The object program is loaded into memory wherever there is room for it.

Relocating Loaders

Page 17: Loaders ( system programming )

Loaders 17

The assembler assembles each procedures segment independently and passes to loader the text and information as to relocation and intersegment references.

The assembler would also provide the loader with additional information, such as the length of the entire program and the length of the transfer vector.

Cont.

Page 18: Loaders ( system programming )

Loaders 18

BINARY SYMBOLIC SUBROUTINE (BSS) loader such as used in the IBM 7094,IBM 1130,GE 635.

The output of the relocating assembler using a BINARY SYMBOLIC SUBROUTINE(BSS) scheme is the Object program and information about all other program its references.

The BSS loader allows many procedure segments but only one data (common)segment.

The BSS loader scheme is often used on computers with a fixed-length direct address instruction format.

Cont.:: Practical relocating loader ::

Page 19: Loaders ( system programming )

Loaders 19

Avoids possible reassembling of all Subroutines when a single Subroutine is changed

Perform the tasks of allocation and linking for the programmer.

Cont.:: Advantages ::

Difficult to implement Algorithm is depends on File structure of the object program. Slower than Absolute loader

:: Disadvantages ::

Page 20: Loaders ( system programming )

Loaders 20

In this type of loaders first load , links and then Relocates segments.

Complete freedom in referencing data or instructions contained in other segments

Perform all linking and relocation at load time. A linking loader is known as general relocatable loader or

direct-linking loader.

Linking Loaders

Page 21: Loaders ( system programming )

Loaders 21

PASS-ONE : accepts object file and produces Global external symbol table (GEST) and copies of the object programs as O/P.

PASS-TWO : object programs are loaded to the primary memory after proper translation of address .

Cont. :: Two-pass Linking loader ::

One pass linking loader performs all operations that are specified in a two-pass linking loaders

:: One-pass Linking loader ::

Page 22: Loaders ( system programming )

Loaders 22

It allows multiple procedure and data segment. It provides flexible inter-segment referencing and Accessing

ability, at same time independent translation of programs.

Cont.:: Advantages ::

It is necessary for allocation, relocation, linking and loading. All the subroutine are required each time in order to execute

a program . It is time consuming.

:: Disadvantages ::

Page 23: Loaders ( system programming )

Loaders 23

Linkers Loaders

Combine the target code with the code of other programs and library routines in order to generate a binary program.

Load executable code into the memory.

Carried out with the help of compiler Part of operating system

The execution of linking can be during compilation or during execution of the

program

The loads the program into the memory when it is scheduled for

execution.

Linkers Vs. loaders

Page 24: Loaders ( system programming )

Loaders 24

What is Loader

Use of Loader

Types of Loader

Linkers vs. Loader

Summary

Reference :: -System Programming by Srimanta Pal OXFORD Publication -web.thu.edu.tw/ctyang/www/files/sp_chap3