Handout#12

S
Sunita Milind DolAssistant Professor em Walchand Institute of Technology, Solapur

Study of Loader

System Programming
Walchand Institute of Technology
Aim:
Study of Loader
Theory:
The loader is program which accepts the object program decks, prepares these
programs for execution by the computer, and initiates the execution.
In particular, the loader must perform four functions:
1. Allocate space in memory for the programs (Allocation)
2. Resolve symbolic references between object decks (Linking)
3. Adjust all address dependent locations, such as address constants, to
correspond to the allocated space (Relocation)
4. Physically place the machine instr
Figure: General Loading Scheme
1. “Compile-and-Go” Loaders
• One method of performing the loader functions is to have the assembler run
in one part of memory and places the assembled machine instruction and
data, as they are assembled, directly into t
• When the assembly is completed, the assembler causes a transfer to the
starting instruction of program. It is used by WATFOR FORTRAN compiler
and other language processors.
Sunita M. Dol, CSE Dept
Institute of Technology, Solapur
HANDOUT#1
The loader is program which accepts the object program decks, prepares these
programs for execution by the computer, and initiates the execution.
In particular, the loader must perform four functions:
space in memory for the programs (Allocation)
Resolve symbolic references between object decks (Linking)
Adjust all address dependent locations, such as address constants, to
correspond to the allocated space (Relocation)
Physically place the machine instruction and data into memory (Loading)
Figure: General Loading Scheme
Go” Loaders
One method of performing the loader functions is to have the assembler run
in one part of memory and places the assembled machine instruction and
they are assembled, directly into their assigned memory locations.
When the assembly is completed, the assembler causes a transfer to the
starting instruction of program. It is used by WATFOR FORTRAN compiler
and other language processors.
Sunita M. Dol, CSE Dept
Page 1
The loader is program which accepts the object program decks, prepares these
programs for execution by the computer, and initiates the execution.
space in memory for the programs (Allocation)
Resolve symbolic references between object decks (Linking)
Adjust all address dependent locations, such as address constants, to
uction and data into memory (Loading)
One method of performing the loader functions is to have the assembler run
in one part of memory and places the assembled machine instruction and
heir assigned memory locations.
When the assembly is completed, the assembler causes a transfer to the
starting instruction of program. It is used by WATFOR FORTRAN compiler
System Programming
Walchand Institute of Technology
• Such a loading scheme commonly called “compile
and-go” which is shown in figure.
Figure 2: Compile
• Advantages of Compile
o It is relatively easy to implement.
o The assembler simply places the code into core; the “loader”
one instruction that transfers to the starting instruction of the newly
assembled program.
• Disadvantages of Compile
o A portion of memory is wasted because the core occupied by the
assembler is unavailable to the object program.
o It is necessary to retranslate the user’s program deck every time it is run.
o It is very difficult to handle multiple segments, especially if the sources
are different languages e.g. one subroutine in assembly language and
another subroutine in FORTRAN or PL/I.
2. General Loader Schemes
• Outputting the instructions and data as they are assembled circumvents the
problem of wasting core for the assembler. Such an output could be saved
and loaded whenever the code was to be executed.
Sunita M. Dol, CSE Dept
Institute of Technology, Solapur
cheme commonly called “compile-and-
go” which is shown in figure.
Figure 2: Compile-and-Go Loader
Advantages of Compile-and-Go Loader
It is relatively easy to implement.
The assembler simply places the code into core; the “loader”
one instruction that transfers to the starting instruction of the newly
assembled program.
Disadvantages of Compile-and-Go Loader
portion of memory is wasted because the core occupied by the
assembler is unavailable to the object program.
t is necessary to retranslate the user’s program deck every time it is run.
is very difficult to handle multiple segments, especially if the sources
are different languages e.g. one subroutine in assembly language and
another subroutine in FORTRAN or PL/I.
General Loader Schemes
Outputting the instructions and data as they are assembled circumvents the
problem of wasting core for the assembler. Such an output could be saved
and loaded whenever the code was to be executed.
Sunita M. Dol, CSE Dept
Page 2
-go” or “assemble-
The assembler simply places the code into core; the “loader” consists of
one instruction that transfers to the starting instruction of the newly
portion of memory is wasted because the core occupied by the
t is necessary to retranslate the user’s program deck every time it is run.
is very difficult to handle multiple segments, especially if the sources
are different languages e.g. one subroutine in assembly language and
Outputting the instructions and data as they are assembled circumvents the
problem of wasting core for the assembler. Such an output could be saved
System Programming
Walchand Institute of Technology
• The assembled programs could be loaded into the same area
assembler occupied. This output form, which may be on cards containing a
coded form of the instructions, is called an object deck.
• The use of an object deck as intermediate data to avoid one disadvantage of
the preceding “compile
program to the system, a loader. The loader accepts the assembled machine
instructions, data, and other information present in the object format, and
places machine instructions and data in core in an executable form.
• Advantages of General Loader Scheme
o The loader is assumed to be smaller than the assembler, so that more
memory is available to the user.
o Reassembly is no longer necessary to run the program at a later date.
o If all the source program translators produce comp
deck formats and use compatible linkage conventions, it is possible to
write subroutines in several different languages since the object decks to
be processed by the loader will all be in the same “language.”
Figure
3. Absolute Loaders
• The simplest type of loaders scheme, which fits the general
as an absolute loader.
Sunita M. Dol, CSE Dept
Institute of Technology, Solapur
The assembled programs could be loaded into the same area
assembler occupied. This output form, which may be on cards containing a
coded form of the instructions, is called an object deck.
The use of an object deck as intermediate data to avoid one disadvantage of
the preceding “compile-and-go” scheme requires the addition of a new
program to the system, a loader. The loader accepts the assembled machine
instructions, data, and other information present in the object format, and
places machine instructions and data in core in an executable form.
antages of General Loader Scheme
The loader is assumed to be smaller than the assembler, so that more
memory is available to the user.
Reassembly is no longer necessary to run the program at a later date.
If all the source program translators produce compatible object program
deck formats and use compatible linkage conventions, it is possible to
write subroutines in several different languages since the object decks to
be processed by the loader will all be in the same “language.”
Figure 3: General Loader Scheme
The simplest type of loaders scheme, which fits the general
as an absolute loader.
Sunita M. Dol, CSE Dept
Page 3
The assembled programs could be loaded into the same area in core that
assembler occupied. This output form, which may be on cards containing a
The use of an object deck as intermediate data to avoid one disadvantage of
e requires the addition of a new
program to the system, a loader. The loader accepts the assembled machine
instructions, data, and other information present in the object format, and
places machine instructions and data in core in an executable form.
The loader is assumed to be smaller than the assembler, so that more
Reassembly is no longer necessary to run the program at a later date.
atible object program
deck formats and use compatible linkage conventions, it is possible to
write subroutines in several different languages since the object decks to
be processed by the loader will all be in the same “language.”
The simplest type of loaders scheme, which fits the general model, is called
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 4
• In this scheme the assembler outputs the machine language translation of the
source program in almost the same form as in the “assemble-and-go”
scheme, except that the data is punched on cards instead of being placed
directly in memory.
• The loader simply accepts the machine language text and places it into core
at the location prescribed by the assembler. This scheme makes more cores
available to the user since the assembler is not in memory at load time.
• Advantage of Absolute Loader
o Absolute loaders are simple to implement
• Disadvantages of Absolute Loader
o First, the programmer must satisfy to the assembler the address in core
where the program is to be loaded.
o Furthermore, if there are multiple subroutines, the programmer must
remember the address of each and use that absolute address explicitly in
his other subroutines to perform subroutines linkage.
o The programmer must be careful not to assign two subroutines to the
same or overlapping locations.
MAIN Program Location Instruction
MAIN START 100
BALR 12,0 100 BALR 12,0
USING MAIN+2, 12 102 .
. . .
. . .
L 15, ASQRT 120 L 15, 142(0, 12)
BALR 14,15 124 BALR 14, 15
. . .
. . .
ASQRT DC F’400’ 244 F’400’
System Programming
Walchand Institute of Technology
END
SQRT SUBROUTINE
SQRT START
USING
.
.
BR
Figure
The loader functions are as follows:
1. Allocation-by programmer
2. Linking-by programmer
3. Relocation-by assembler
4. Loading-by loader
Sunita M. Dol, CSE Dept
Institute of Technology, Solapur
248
Location Instruction
400 400
*, 15 . .
. .
. .
14 476 BCR
Figure 4: Absolute Loader Example
Figure 5: Absolute Loader
The loader functions are as follows:
programmer
by programmer
by assembler
Sunita M. Dol, CSE Dept
Page 5
Instruction
15, 14
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 6
4. Relocating Loaders
• 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 general class of relocating loaders was introduced.
• An example of a relocating loader is that of the Binary symbolic routine
(BSS) loader
• The output of a relocating assembler using a BSS scheme is the object
program and information about all other programs it references. In addition,
there is information as to location in this program that need to be changed if
it is to be loaded in an arbitrary place in core, i.e. the locations which are
dependent on the core allocation.
• For each source program the assembler outputs a text prefixed by a transfer
vector that consists of address containing names of the subroutines
referenced by the source program.
• The assembler would also provide the loader with additional information,
such as the length of the entire program and the length of transfer vector
portion. After loading the text and transfer vector into core, the loader would
load each subroutine identified in the transfer vector. It would then place a
transfer instruction to the corresponding subroutine in each entry in the
transfer vector.
Source Program Program length = 48 bytes
Transfer vector = 8 bytes
Rel.
addr.
Relocation Object code
MAIN START
EXTRN SQRT 0 00 ‘SQRT’
EXTRN ERR 4 00 ‘ERRb’
ST 14,
SAVE
8 01 ST 14, 36
L 1, =F’9’ 12 01 L 1, 40
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 7
BAL 14,
SQRT
16 01 BAL 14, 0
C 1, =F’3’ 20 01 C 1, 44
BNE ERR 24 01 BC 7, 4
L 14,
SAVE
28 01 L 14, 36
BR 14 32 0 BCR 15, 14
SAVE DS F 34 0 (Skipped for
alignment)
END 36 00 (Temporary location)
40 00 9
44 00 3
Figure 6: Relocation Loader Example
System Programming
Walchand Institute of Technology
Figure
• The four functions of the loader were all performed automatically by the
BSS loader.
• It should be noted that
o the relocation bits are used to solve the problem of relocation;
o the transfer vector is used to solve the problem of linking; and
o the program length information is used to solve the problem of
allocation.
• Disadvantages:
o First, the transfer vector linkag
suited for loading or storing external data.
o Second, the transfer vector increases the size of the object program in
memory.
Sunita M. Dol, CSE Dept
Institute of Technology, Solapur
Figure 7: Loading of program in memory
The four functions of the loader were all performed automatically by the
It should be noted that
the relocation bits are used to solve the problem of relocation;
the transfer vector is used to solve the problem of linking; and
the program length information is used to solve the problem of
First, the transfer vector linkage is only useful for transfers, and well
suited for loading or storing external data.
Second, the transfer vector increases the size of the object program in
Sunita M. Dol, CSE Dept
Page 8
The four functions of the loader were all performed automatically by the
the relocation bits are used to solve the problem of relocation;
the transfer vector is used to solve the problem of linking; and
the program length information is used to solve the problem of
e is only useful for transfers, and well-
Second, the transfer vector increases the size of the object program in
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 9
o Finally, the BSS loader, as described, processes procedure segments but
does not facilitate access to data segments that can be shared.
5. Direct-Linking Loaders
• A direct linking loader is general relocatable loader, and is perhaps the most
popular loading scheme presently used.
• The direct linking loader has advantage of the allowing the programmer
multiple procedures segments and multiple data segments and of giving him
complete freedom in referencing data or instructions contained in other
segments. This provides flexible intersegment referencing and accessing
ability, while at the same time allowing independent translations of
programs.
• The assembler must give the loader the following information with each
procedure or data segment:
1. The length of segment
2. A list of all symbols in the segment that may be referenced by other
segments and their relative within the segment
3. A list of all symbol not defined in segment but referenced in the segment
4. Information as to where address constants are located in the segment and
a description of how to revise their values.
5. The machine code translation of the source program and the relative
address assigned.
• A simple example using a direct linking loading scheme is presented. A
source program is translated by an assembler to produce the object depicted
in the right column. Mnemonic machine codes have again been used.
Program Translation
Card
No.
Rel.
Loc.
1 JOHN START
2 ENTRY RESULT
3 EXTRN SUM
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 10
4 BALR 12, 0 0 BALR 12, 0
5 USING *, 10
6 ST 14, SAVE 2 ST 14, 54(0, 12)
7 L 1,
POINTER
6 L 1, 46(0, 12)
8 L 15, ASUM 10 L 15, 58(0, 12)
9 BALR 14, 15 14 BALR 14, 15
10 ST 1, RESULT 16 ST 1, 50(0, 12)
11 L 14, SAVE 20 L 14, 54(0, 12)
12 BR 14 24 BCR 15, 14
26 ----
13 TABLE DC F’1, 7, 9,
10, 3’
28 1
32 7
36 9
40 10
44 3
14 POINTER DC A(TABLE) 48 28
15 RESULT DS F 52 ----
16 SAVE DS F 56 ----
17 ASUM DC A(SUM) 60 ?
18 END 64
Figure 8: Assembly source program and its translation
• The assembler produces four types of cards
1. ESD (External Symbol Directory)
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 11
2. TXT (Text Card)
3. RLD (Relocation and Linkage Directory)
4. END
1. ESD (External Symbol Directory)
– This card contain information about
• all symbols that are defined in this program but that may be
referenced elsewhere and
• all symbols referenced in this program but defined elsewhere
– ‘Type’ mnemonic in ESD card can be
• SD (Segment Definition)
• LD (Local Definition)
• ER (External Reference)
Reference
no.
Symbol Type Relative
location
Length
1 JOHN SD 0 64
2 RESULT LD 52 ----
3 SUM ER ---- ----
2. TXT card
– This card contain actual object code translated version of the source
program.
Reference
number
Relative
location
Object code
4 0 BALR 12, 0
6 2 ST 14, 54(0, 12)
7 6 L 1, 46(0, 12)
8 10 L 15, 58(0, 12)
9 14 BALR 14, 15
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 12
10 16 ST 1, 50(0, 12)
11 20 L 14, 54(0, 12)
12 24 BCR 15, 14
13 28 1
13 32 7
13 36 9
13 40 10
13 44 3
14 48 28
17 60 0
3. RLD card
– This card contain following information
• The location of each constant that needs to be changed due to
relocation
• By what it has to be changed
• The operation to be performed
Reference
no.
Symbol Flag Length Relative
location
14 JOHN + 4 48
17 SUM + 4 60
Conclusion:
The loader is program which accepts the object program decks, prepares
these programs for execution by the computer, and initiates the execution
Following types of loaders are discussed:
o Compile and Go Loader
System Programming Sunita M. Dol, CSE Dept
Walchand Institute of Technology, Solapur Page 13
o General Loader Scheme
o Absolute Loader
o Relocating Loader
o Direct Linking Loader

Recomendados

Handout#07 por
Handout#07Handout#07
Handout#07Sunita Milind Dol
136 visualizações6 slides
Handout#08 por
Handout#08Handout#08
Handout#08Sunita Milind Dol
136 visualizações5 slides
Handout#02 por
Handout#02Handout#02
Handout#02Sunita Milind Dol
124 visualizações5 slides
Assignment1 por
Assignment1Assignment1
Assignment1Sunita Milind Dol
81 visualizações9 slides
Assignment11 por
Assignment11Assignment11
Assignment11Sunita Milind Dol
89 visualizações6 slides
Handout#10 por
Handout#10Handout#10
Handout#10Sunita Milind Dol
129 visualizações8 slides

Mais conteúdo relacionado

Mais procurados

Handout#05 por
Handout#05Handout#05
Handout#05Sunita Milind Dol
153 visualizações7 slides
Handout#06 por
Handout#06Handout#06
Handout#06Sunita Milind Dol
138 visualizações7 slides
Assignment4 por
Assignment4Assignment4
Assignment4Sunita Milind Dol
81 visualizações9 slides
Handout#04 por
Handout#04Handout#04
Handout#04Sunita Milind Dol
146 visualizações5 slides
Handout#01 por
Handout#01Handout#01
Handout#01Sunita Milind Dol
133 visualizações8 slides
Phases of the Compiler - Systems Programming por
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems ProgrammingMukesh Tekwani
62K visualizações6 slides

Mais procurados(20)

Phases of the Compiler - Systems Programming por Mukesh Tekwani
Phases of the Compiler - Systems ProgrammingPhases of the Compiler - Systems Programming
Phases of the Compiler - Systems Programming
Mukesh Tekwani62K visualizações
Compiler Engineering Lab#1 por MashaelQ
Compiler Engineering Lab#1Compiler Engineering Lab#1
Compiler Engineering Lab#1
MashaelQ1.6K visualizações
Principles of compiler design por Janani Parthiban
Principles of compiler designPrinciples of compiler design
Principles of compiler design
Janani Parthiban7.6K visualizações
Compiler gate question key por ArthyR3
Compiler gate question keyCompiler gate question key
Compiler gate question key
ArthyR3139 visualizações
Cs6660 compiler design por hari2010
Cs6660 compiler designCs6660 compiler design
Cs6660 compiler design
hari20102.4K visualizações
Java conceptual learning material por ArthyR3
Java conceptual learning materialJava conceptual learning material
Java conceptual learning material
ArthyR3284 visualizações
Lexical analyzer por Ashwini Sonawane
Lexical analyzerLexical analyzer
Lexical analyzer
Ashwini Sonawane48.3K visualizações
Introduction to programming with c, por Hossain Md Shakhawat
Introduction to programming with c,Introduction to programming with c,
Introduction to programming with c,
Hossain Md Shakhawat5.7K visualizações
Principles of compiler design por DHARANI BABU
Principles of compiler designPrinciples of compiler design
Principles of compiler design
DHARANI BABU6.5K visualizações
C language por spatidar0
C languageC language
C language
spatidar0859 visualizações
Introduction to C programming por Rokonuzzaman Rony
Introduction to C programmingIntroduction to C programming
Introduction to C programming
Rokonuzzaman Rony699 visualizações
Compiler question bank por ArthyR3
Compiler question bankCompiler question bank
Compiler question bank
ArthyR3421 visualizações
Chap 1-language processor por shindept123
Chap 1-language processorChap 1-language processor
Chap 1-language processor
shindept1232.7K visualizações
Intermediate code- generation por rawan_z
Intermediate code- generationIntermediate code- generation
Intermediate code- generation
rawan_z19.5K visualizações

Similar a Handout#12

Loaders ( system programming ) por
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming ) Adarsh Patel
18.5K visualizações24 slides
Loader and Its types por
Loader and Its typesLoader and Its types
Loader and Its typesParth Dodiya
39.2K visualizações24 slides
Loaders por
LoadersLoaders
LoadersSathasivam Rangasamy
36.1K visualizações31 slides
system prgramming - loaders-linkers.pdf por
system prgramming - loaders-linkers.pdfsystem prgramming - loaders-linkers.pdf
system prgramming - loaders-linkers.pdfSATHYABAMAMADHANKUMA
7 visualizações59 slides
Linker and Loader por
Linker and Loader Linker and Loader
Linker and Loader sonalikharade3
2.4K visualizações17 slides
Unit 3 por
Unit 3Unit 3
Unit 3pm_ghate
3.2K visualizações82 slides

Similar a Handout#12(20)

Loaders ( system programming ) por Adarsh Patel
Loaders ( system programming ) Loaders ( system programming )
Loaders ( system programming )
Adarsh Patel18.5K visualizações
Loader and Its types por Parth Dodiya
Loader and Its typesLoader and Its types
Loader and Its types
Parth Dodiya39.2K visualizações
system prgramming - loaders-linkers.pdf por SATHYABAMAMADHANKUMA
system prgramming - loaders-linkers.pdfsystem prgramming - loaders-linkers.pdf
system prgramming - loaders-linkers.pdf
SATHYABAMAMADHANKUMA7 visualizações
Linker and Loader por sonalikharade3
Linker and Loader Linker and Loader
Linker and Loader
sonalikharade32.4K visualizações
Unit 3 por pm_ghate
Unit 3Unit 3
Unit 3
pm_ghate3.2K visualizações
loaders and linkers por Temesgen Molla
 loaders and linkers loaders and linkers
loaders and linkers
Temesgen Molla9.9K visualizações
Hm system programming class 1 por Hitesh Mohapatra
Hm system programming class 1Hm system programming class 1
Hm system programming class 1
Hitesh Mohapatra611 visualizações
Loader2 por deepan62
Loader2Loader2
Loader2
deepan6215 visualizações
Introduction to C Programming por Selvaraj Seerangan
Introduction to C ProgrammingIntroduction to C Programming
Introduction to C Programming
Selvaraj Seerangan133 visualizações
The role of the cpu in the operation por mary_ramsay
The role of the cpu in the operationThe role of the cpu in the operation
The role of the cpu in the operation
mary_ramsay524 visualizações
WEBSITE DEVELOPMENT por shahzadebaujiti
WEBSITE DEVELOPMENTWEBSITE DEVELOPMENT
WEBSITE DEVELOPMENT
shahzadebaujiti65 visualizações
CS8251_QB_answers.pdf por vino108206
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdf
vino1082067 visualizações
Chapter1.pdf por tharwatabdulhmed
Chapter1.pdfChapter1.pdf
Chapter1.pdf
tharwatabdulhmed10 visualizações
System Programming VV Notes.pdf por bharathreddy223930
System Programming VV Notes.pdfSystem Programming VV Notes.pdf
System Programming VV Notes.pdf
bharathreddy223930323 visualizações
parallel programming models por Swetha S
 parallel programming models parallel programming models
parallel programming models
Swetha S164 visualizações
COM1407: Introduction to C Programming por Hemantha Kulathilake
COM1407: Introduction to C Programming COM1407: Introduction to C Programming
COM1407: Introduction to C Programming
Hemantha Kulathilake267 visualizações
Org-&-Arch-2.ppt por MahmoudNazzal7
Org-&-Arch-2.pptOrg-&-Arch-2.ppt
Org-&-Arch-2.ppt
MahmoudNazzal76 visualizações
CSO Laboratory Manual por Dwight Sabio
CSO Laboratory ManualCSO Laboratory Manual
CSO Laboratory Manual
Dwight Sabio1.1K visualizações

Mais de Sunita Milind Dol

9.Joins.pdf por
9.Joins.pdf9.Joins.pdf
9.Joins.pdfSunita Milind Dol
1.7K visualizações9 slides
8.Views.pdf por
8.Views.pdf8.Views.pdf
8.Views.pdfSunita Milind Dol
1.7K visualizações5 slides
7. Nested Subqueries.pdf por
7. Nested Subqueries.pdf7. Nested Subqueries.pdf
7. Nested Subqueries.pdfSunita Milind Dol
1.7K visualizações9 slides
6. Aggregate Functions.pdf por
6. Aggregate Functions.pdf6. Aggregate Functions.pdf
6. Aggregate Functions.pdfSunita Milind Dol
1.7K visualizações12 slides
5. Basic Structure of SQL Queries.pdf por
5. Basic Structure of SQL Queries.pdf5. Basic Structure of SQL Queries.pdf
5. Basic Structure of SQL Queries.pdfSunita Milind Dol
1.7K visualizações64 slides
4. DML.pdf por
4. DML.pdf4. DML.pdf
4. DML.pdfSunita Milind Dol
1.7K visualizações17 slides

Mais de Sunita Milind Dol(18)

9.Joins.pdf por Sunita Milind Dol
9.Joins.pdf9.Joins.pdf
9.Joins.pdf
Sunita Milind Dol1.7K visualizações
8.Views.pdf por Sunita Milind Dol
8.Views.pdf8.Views.pdf
8.Views.pdf
Sunita Milind Dol1.7K visualizações
7. Nested Subqueries.pdf por Sunita Milind Dol
7. Nested Subqueries.pdf7. Nested Subqueries.pdf
7. Nested Subqueries.pdf
Sunita Milind Dol1.7K visualizações
6. Aggregate Functions.pdf por Sunita Milind Dol
6. Aggregate Functions.pdf6. Aggregate Functions.pdf
6. Aggregate Functions.pdf
Sunita Milind Dol1.7K visualizações
5. Basic Structure of SQL Queries.pdf por Sunita Milind Dol
5. Basic Structure of SQL Queries.pdf5. Basic Structure of SQL Queries.pdf
5. Basic Structure of SQL Queries.pdf
Sunita Milind Dol1.7K visualizações
4. DML.pdf por Sunita Milind Dol
4. DML.pdf4. DML.pdf
4. DML.pdf
Sunita Milind Dol1.7K visualizações
3. DDL.pdf por Sunita Milind Dol
3. DDL.pdf3. DDL.pdf
3. DDL.pdf
Sunita Milind Dol1.7K visualizações
2. SQL Introduction.pdf por Sunita Milind Dol
2. SQL Introduction.pdf2. SQL Introduction.pdf
2. SQL Introduction.pdf
Sunita Milind Dol1.7K visualizações
1. University Example.pdf por Sunita Milind Dol
1. University Example.pdf1. University Example.pdf
1. University Example.pdf
Sunita Milind Dol1.7K visualizações

Último

cloud computing-virtualization.pptx por
cloud computing-virtualization.pptxcloud computing-virtualization.pptx
cloud computing-virtualization.pptxRajaulKarim20
82 visualizações31 slides
MSA Website Slideshow (16).pdf por
MSA Website Slideshow (16).pdfMSA Website Slideshow (16).pdf
MSA Website Slideshow (16).pdfmsaucla
39 visualizações8 slides
Dynamics of Hard-Magnetic Soft Materials por
Dynamics of Hard-Magnetic Soft MaterialsDynamics of Hard-Magnetic Soft Materials
Dynamics of Hard-Magnetic Soft MaterialsShivendra Nandan
13 visualizações32 slides
LFA-NPG-Paper.pdf por
LFA-NPG-Paper.pdfLFA-NPG-Paper.pdf
LFA-NPG-Paper.pdfharinsrikanth
40 visualizações13 slides
CHI-SQUARE ( χ2) TESTS.pptx por
CHI-SQUARE ( χ2) TESTS.pptxCHI-SQUARE ( χ2) TESTS.pptx
CHI-SQUARE ( χ2) TESTS.pptxssusera597c5
20 visualizações33 slides
Design and analysis of a new undergraduate Computer Engineering degree – a me... por
Design and analysis of a new undergraduate Computer Engineering degree – a me...Design and analysis of a new undergraduate Computer Engineering degree – a me...
Design and analysis of a new undergraduate Computer Engineering degree – a me...WaelBadawy6
52 visualizações4 slides

Último(20)

cloud computing-virtualization.pptx por RajaulKarim20
cloud computing-virtualization.pptxcloud computing-virtualization.pptx
cloud computing-virtualization.pptx
RajaulKarim2082 visualizações
MSA Website Slideshow (16).pdf por msaucla
MSA Website Slideshow (16).pdfMSA Website Slideshow (16).pdf
MSA Website Slideshow (16).pdf
msaucla39 visualizações
Dynamics of Hard-Magnetic Soft Materials por Shivendra Nandan
Dynamics of Hard-Magnetic Soft MaterialsDynamics of Hard-Magnetic Soft Materials
Dynamics of Hard-Magnetic Soft Materials
Shivendra Nandan13 visualizações
LFA-NPG-Paper.pdf por harinsrikanth
LFA-NPG-Paper.pdfLFA-NPG-Paper.pdf
LFA-NPG-Paper.pdf
harinsrikanth40 visualizações
CHI-SQUARE ( χ2) TESTS.pptx por ssusera597c5
CHI-SQUARE ( χ2) TESTS.pptxCHI-SQUARE ( χ2) TESTS.pptx
CHI-SQUARE ( χ2) TESTS.pptx
ssusera597c520 visualizações
Design and analysis of a new undergraduate Computer Engineering degree – a me... por WaelBadawy6
Design and analysis of a new undergraduate Computer Engineering degree – a me...Design and analysis of a new undergraduate Computer Engineering degree – a me...
Design and analysis of a new undergraduate Computer Engineering degree – a me...
WaelBadawy652 visualizações
Electronic Devices - Integrated Circuit.pdf por booksarpita
Electronic Devices - Integrated Circuit.pdfElectronic Devices - Integrated Circuit.pdf
Electronic Devices - Integrated Circuit.pdf
booksarpita11 visualizações
FLOW IN PIPES NOTES.pdf por Dearest Arhelo
FLOW IN PIPES NOTES.pdfFLOW IN PIPES NOTES.pdf
FLOW IN PIPES NOTES.pdf
Dearest Arhelo90 visualizações
SNMPx por Amatullahbutt
SNMPxSNMPx
SNMPx
Amatullahbutt12 visualizações
STUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptx por AnnieRachelJohn
STUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptxSTUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptx
STUDY OF SMART MATERIALS USED IN CONSTRUCTION-1.pptx
AnnieRachelJohn25 visualizações
Saikat Chakraborty Java Oracle Certificate.pdf por SaikatChakraborty787148
Saikat Chakraborty Java Oracle Certificate.pdfSaikat Chakraborty Java Oracle Certificate.pdf
Saikat Chakraborty Java Oracle Certificate.pdf
SaikatChakraborty78714813 visualizações
A multi-microcontroller-based hardware for deploying Tiny machine learning mo... por IJECEIAES
A multi-microcontroller-based hardware for deploying Tiny machine learning mo...A multi-microcontroller-based hardware for deploying Tiny machine learning mo...
A multi-microcontroller-based hardware for deploying Tiny machine learning mo...
IJECEIAES10 visualizações
SWM L15-L28_drhasan (Part 2).pdf por MahmudHasan747870
SWM L15-L28_drhasan (Part 2).pdfSWM L15-L28_drhasan (Part 2).pdf
SWM L15-L28_drhasan (Part 2).pdf
MahmudHasan74787028 visualizações
2_DVD_ASIC_Design_FLow.pdf por Usha Mehta
2_DVD_ASIC_Design_FLow.pdf2_DVD_ASIC_Design_FLow.pdf
2_DVD_ASIC_Design_FLow.pdf
Usha Mehta14 visualizações
What is Unit Testing por Sadaaki Emura
What is Unit TestingWhat is Unit Testing
What is Unit Testing
Sadaaki Emura23 visualizações
Investor Presentation por eser sevinç
Investor PresentationInvestor Presentation
Investor Presentation
eser sevinç16 visualizações

Handout#12

  • 1. System Programming Walchand Institute of Technology Aim: Study of Loader Theory: The loader is program which accepts the object program decks, prepares these programs for execution by the computer, and initiates the execution. In particular, the loader must perform four functions: 1. Allocate space in memory for the programs (Allocation) 2. Resolve symbolic references between object decks (Linking) 3. Adjust all address dependent locations, such as address constants, to correspond to the allocated space (Relocation) 4. Physically place the machine instr Figure: General Loading Scheme 1. “Compile-and-Go” Loaders • One method of performing the loader functions is to have the assembler run in one part of memory and places the assembled machine instruction and data, as they are assembled, directly into t • When the assembly is completed, the assembler causes a transfer to the starting instruction of program. It is used by WATFOR FORTRAN compiler and other language processors. Sunita M. Dol, CSE Dept Institute of Technology, Solapur HANDOUT#1 The loader is program which accepts the object program decks, prepares these programs for execution by the computer, and initiates the execution. In particular, the loader must perform four functions: space in memory for the programs (Allocation) Resolve symbolic references between object decks (Linking) Adjust all address dependent locations, such as address constants, to correspond to the allocated space (Relocation) Physically place the machine instruction and data into memory (Loading) Figure: General Loading Scheme Go” Loaders One method of performing the loader functions is to have the assembler run in one part of memory and places the assembled machine instruction and they are assembled, directly into their assigned memory locations. When the assembly is completed, the assembler causes a transfer to the starting instruction of program. It is used by WATFOR FORTRAN compiler and other language processors. Sunita M. Dol, CSE Dept Page 1 The loader is program which accepts the object program decks, prepares these programs for execution by the computer, and initiates the execution. space in memory for the programs (Allocation) Resolve symbolic references between object decks (Linking) Adjust all address dependent locations, such as address constants, to uction and data into memory (Loading) One method of performing the loader functions is to have the assembler run in one part of memory and places the assembled machine instruction and heir assigned memory locations. When the assembly is completed, the assembler causes a transfer to the starting instruction of program. It is used by WATFOR FORTRAN compiler
  • 2. System Programming Walchand Institute of Technology • Such a loading scheme commonly called “compile and-go” which is shown in figure. Figure 2: Compile • Advantages of Compile o It is relatively easy to implement. o The assembler simply places the code into core; the “loader” one instruction that transfers to the starting instruction of the newly assembled program. • Disadvantages of Compile o A portion of memory is wasted because the core occupied by the assembler is unavailable to the object program. o It is necessary to retranslate the user’s program deck every time it is run. o It is very difficult to handle multiple segments, especially if the sources are different languages e.g. one subroutine in assembly language and another subroutine in FORTRAN or PL/I. 2. General Loader Schemes • Outputting the instructions and data as they are assembled circumvents the problem of wasting core for the assembler. Such an output could be saved and loaded whenever the code was to be executed. Sunita M. Dol, CSE Dept Institute of Technology, Solapur cheme commonly called “compile-and- go” which is shown in figure. Figure 2: Compile-and-Go Loader Advantages of Compile-and-Go Loader It is relatively easy to implement. The assembler simply places the code into core; the “loader” one instruction that transfers to the starting instruction of the newly assembled program. Disadvantages of Compile-and-Go Loader portion of memory is wasted because the core occupied by the assembler is unavailable to the object program. t is necessary to retranslate the user’s program deck every time it is run. is very difficult to handle multiple segments, especially if the sources are different languages e.g. one subroutine in assembly language and another subroutine in FORTRAN or PL/I. General Loader Schemes Outputting the instructions and data as they are assembled circumvents the problem of wasting core for the assembler. Such an output could be saved and loaded whenever the code was to be executed. Sunita M. Dol, CSE Dept Page 2 -go” or “assemble- The assembler simply places the code into core; the “loader” consists of one instruction that transfers to the starting instruction of the newly portion of memory is wasted because the core occupied by the t is necessary to retranslate the user’s program deck every time it is run. is very difficult to handle multiple segments, especially if the sources are different languages e.g. one subroutine in assembly language and Outputting the instructions and data as they are assembled circumvents the problem of wasting core for the assembler. Such an output could be saved
  • 3. System Programming Walchand Institute of Technology • The assembled programs could be loaded into the same area assembler occupied. This output form, which may be on cards containing a coded form of the instructions, is called an object deck. • The use of an object deck as intermediate data to avoid one disadvantage of the preceding “compile program to the system, a loader. The loader accepts the assembled machine instructions, data, and other information present in the object format, and places machine instructions and data in core in an executable form. • Advantages of General Loader Scheme o The loader is assumed to be smaller than the assembler, so that more memory is available to the user. o Reassembly is no longer necessary to run the program at a later date. o If all the source program translators produce comp deck formats and use compatible linkage conventions, it is possible to write subroutines in several different languages since the object decks to be processed by the loader will all be in the same “language.” Figure 3. Absolute Loaders • The simplest type of loaders scheme, which fits the general as an absolute loader. Sunita M. Dol, CSE Dept Institute of Technology, Solapur The assembled programs could be loaded into the same area assembler occupied. This output form, which may be on cards containing a coded form of the instructions, is called an object deck. The use of an object deck as intermediate data to avoid one disadvantage of the preceding “compile-and-go” scheme requires the addition of a new program to the system, a loader. The loader accepts the assembled machine instructions, data, and other information present in the object format, and places machine instructions and data in core in an executable form. antages of General Loader Scheme The loader is assumed to be smaller than the assembler, so that more memory is available to the user. Reassembly is no longer necessary to run the program at a later date. If all the source program translators produce compatible object program deck formats and use compatible linkage conventions, it is possible to write subroutines in several different languages since the object decks to be processed by the loader will all be in the same “language.” Figure 3: General Loader Scheme The simplest type of loaders scheme, which fits the general as an absolute loader. Sunita M. Dol, CSE Dept Page 3 The assembled programs could be loaded into the same area in core that assembler occupied. This output form, which may be on cards containing a The use of an object deck as intermediate data to avoid one disadvantage of e requires the addition of a new program to the system, a loader. The loader accepts the assembled machine instructions, data, and other information present in the object format, and places machine instructions and data in core in an executable form. The loader is assumed to be smaller than the assembler, so that more Reassembly is no longer necessary to run the program at a later date. atible object program deck formats and use compatible linkage conventions, it is possible to write subroutines in several different languages since the object decks to be processed by the loader will all be in the same “language.” The simplest type of loaders scheme, which fits the general model, is called
  • 4. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 4 • In this scheme the assembler outputs the machine language translation of the source program in almost the same form as in the “assemble-and-go” scheme, except that the data is punched on cards instead of being placed directly in memory. • The loader simply accepts the machine language text and places it into core at the location prescribed by the assembler. This scheme makes more cores available to the user since the assembler is not in memory at load time. • Advantage of Absolute Loader o Absolute loaders are simple to implement • Disadvantages of Absolute Loader o First, the programmer must satisfy to the assembler the address in core where the program is to be loaded. o Furthermore, if there are multiple subroutines, the programmer must remember the address of each and use that absolute address explicitly in his other subroutines to perform subroutines linkage. o The programmer must be careful not to assign two subroutines to the same or overlapping locations. MAIN Program Location Instruction MAIN START 100 BALR 12,0 100 BALR 12,0 USING MAIN+2, 12 102 . . . . . . . L 15, ASQRT 120 L 15, 142(0, 12) BALR 14,15 124 BALR 14, 15 . . . . . . ASQRT DC F’400’ 244 F’400’
  • 5. System Programming Walchand Institute of Technology END SQRT SUBROUTINE SQRT START USING . . BR Figure The loader functions are as follows: 1. Allocation-by programmer 2. Linking-by programmer 3. Relocation-by assembler 4. Loading-by loader Sunita M. Dol, CSE Dept Institute of Technology, Solapur 248 Location Instruction 400 400 *, 15 . . . . . . 14 476 BCR Figure 4: Absolute Loader Example Figure 5: Absolute Loader The loader functions are as follows: programmer by programmer by assembler Sunita M. Dol, CSE Dept Page 5 Instruction 15, 14
  • 6. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 6 4. Relocating Loaders • 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 general class of relocating loaders was introduced. • An example of a relocating loader is that of the Binary symbolic routine (BSS) loader • The output of a relocating assembler using a BSS scheme is the object program and information about all other programs it references. In addition, there is information as to location in this program that need to be changed if it is to be loaded in an arbitrary place in core, i.e. the locations which are dependent on the core allocation. • For each source program the assembler outputs a text prefixed by a transfer vector that consists of address containing names of the subroutines referenced by the source program. • The assembler would also provide the loader with additional information, such as the length of the entire program and the length of transfer vector portion. After loading the text and transfer vector into core, the loader would load each subroutine identified in the transfer vector. It would then place a transfer instruction to the corresponding subroutine in each entry in the transfer vector. Source Program Program length = 48 bytes Transfer vector = 8 bytes Rel. addr. Relocation Object code MAIN START EXTRN SQRT 0 00 ‘SQRT’ EXTRN ERR 4 00 ‘ERRb’ ST 14, SAVE 8 01 ST 14, 36 L 1, =F’9’ 12 01 L 1, 40
  • 7. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 7 BAL 14, SQRT 16 01 BAL 14, 0 C 1, =F’3’ 20 01 C 1, 44 BNE ERR 24 01 BC 7, 4 L 14, SAVE 28 01 L 14, 36 BR 14 32 0 BCR 15, 14 SAVE DS F 34 0 (Skipped for alignment) END 36 00 (Temporary location) 40 00 9 44 00 3 Figure 6: Relocation Loader Example
  • 8. System Programming Walchand Institute of Technology Figure • The four functions of the loader were all performed automatically by the BSS loader. • It should be noted that o the relocation bits are used to solve the problem of relocation; o the transfer vector is used to solve the problem of linking; and o the program length information is used to solve the problem of allocation. • Disadvantages: o First, the transfer vector linkag suited for loading or storing external data. o Second, the transfer vector increases the size of the object program in memory. Sunita M. Dol, CSE Dept Institute of Technology, Solapur Figure 7: Loading of program in memory The four functions of the loader were all performed automatically by the It should be noted that the relocation bits are used to solve the problem of relocation; the transfer vector is used to solve the problem of linking; and the program length information is used to solve the problem of First, the transfer vector linkage is only useful for transfers, and well suited for loading or storing external data. Second, the transfer vector increases the size of the object program in Sunita M. Dol, CSE Dept Page 8 The four functions of the loader were all performed automatically by the the relocation bits are used to solve the problem of relocation; the transfer vector is used to solve the problem of linking; and the program length information is used to solve the problem of e is only useful for transfers, and well- Second, the transfer vector increases the size of the object program in
  • 9. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 9 o Finally, the BSS loader, as described, processes procedure segments but does not facilitate access to data segments that can be shared. 5. Direct-Linking Loaders • A direct linking loader is general relocatable loader, and is perhaps the most popular loading scheme presently used. • The direct linking loader has advantage of the allowing the programmer multiple procedures segments and multiple data segments and of giving him complete freedom in referencing data or instructions contained in other segments. This provides flexible intersegment referencing and accessing ability, while at the same time allowing independent translations of programs. • The assembler must give the loader the following information with each procedure or data segment: 1. The length of segment 2. A list of all symbols in the segment that may be referenced by other segments and their relative within the segment 3. A list of all symbol not defined in segment but referenced in the segment 4. Information as to where address constants are located in the segment and a description of how to revise their values. 5. The machine code translation of the source program and the relative address assigned. • A simple example using a direct linking loading scheme is presented. A source program is translated by an assembler to produce the object depicted in the right column. Mnemonic machine codes have again been used. Program Translation Card No. Rel. Loc. 1 JOHN START 2 ENTRY RESULT 3 EXTRN SUM
  • 10. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 10 4 BALR 12, 0 0 BALR 12, 0 5 USING *, 10 6 ST 14, SAVE 2 ST 14, 54(0, 12) 7 L 1, POINTER 6 L 1, 46(0, 12) 8 L 15, ASUM 10 L 15, 58(0, 12) 9 BALR 14, 15 14 BALR 14, 15 10 ST 1, RESULT 16 ST 1, 50(0, 12) 11 L 14, SAVE 20 L 14, 54(0, 12) 12 BR 14 24 BCR 15, 14 26 ---- 13 TABLE DC F’1, 7, 9, 10, 3’ 28 1 32 7 36 9 40 10 44 3 14 POINTER DC A(TABLE) 48 28 15 RESULT DS F 52 ---- 16 SAVE DS F 56 ---- 17 ASUM DC A(SUM) 60 ? 18 END 64 Figure 8: Assembly source program and its translation • The assembler produces four types of cards 1. ESD (External Symbol Directory)
  • 11. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 11 2. TXT (Text Card) 3. RLD (Relocation and Linkage Directory) 4. END 1. ESD (External Symbol Directory) – This card contain information about • all symbols that are defined in this program but that may be referenced elsewhere and • all symbols referenced in this program but defined elsewhere – ‘Type’ mnemonic in ESD card can be • SD (Segment Definition) • LD (Local Definition) • ER (External Reference) Reference no. Symbol Type Relative location Length 1 JOHN SD 0 64 2 RESULT LD 52 ---- 3 SUM ER ---- ---- 2. TXT card – This card contain actual object code translated version of the source program. Reference number Relative location Object code 4 0 BALR 12, 0 6 2 ST 14, 54(0, 12) 7 6 L 1, 46(0, 12) 8 10 L 15, 58(0, 12) 9 14 BALR 14, 15
  • 12. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 12 10 16 ST 1, 50(0, 12) 11 20 L 14, 54(0, 12) 12 24 BCR 15, 14 13 28 1 13 32 7 13 36 9 13 40 10 13 44 3 14 48 28 17 60 0 3. RLD card – This card contain following information • The location of each constant that needs to be changed due to relocation • By what it has to be changed • The operation to be performed Reference no. Symbol Flag Length Relative location 14 JOHN + 4 48 17 SUM + 4 60 Conclusion: The loader is program which accepts the object program decks, prepares these programs for execution by the computer, and initiates the execution Following types of loaders are discussed: o Compile and Go Loader
  • 13. System Programming Sunita M. Dol, CSE Dept Walchand Institute of Technology, Solapur Page 13 o General Loader Scheme o Absolute Loader o Relocating Loader o Direct Linking Loader