SlideShare une entreprise Scribd logo
1  sur  82
Télécharger pour lire hors ligne
UNIT III
LINKERS AND LOADERS AND SOFTWARE
TOOLS
Pre requisite :-
Know the basic of fundamental of operating system.
Outcomes
Aim of this chapter students are aware with loader .
Software tool
UNIT III
LINKERS AND LOADERS AND SOFTWARE
TOOLS
Contents :
Basic loaders functions, central loaders scheme Absolute loaders,
Subroutine linkers, relocation
Loader, Direct linking loader, Dynamic linking loader, Design of
absolute loaders direct linking loader,
Implantation of MS DOS linker,Implantation of MS DOS linker,
Software tools for program development, editors, debug monitor,
programming environment, user interfaces.
LINKERS AND LOADERS & SOFTWARE TOOLS
Execution of program involves the following steps
Translation of the programs .
Linking of the program with other program needed for its
execution.
Relocation of the program to execute from the specific memory
area allocated to it.
Loading of the program in the memory for the purpose of
execution .
LINKERS & LOADERS & SOFTWARE TOOLS
A schematic of Program execution
Translator Linker Loader
Binary
Program
Source
Program
Object
Modules
Binary
Programs
Control FlowData Flow
FUNCTIONS OF LOADER
Loader:
The loader is a program which accepts object codes and prepares
them for execution and initiates execution.
The loader is responsible for the activities such asThe loader is responsible for the activities such as
allocation ,linking, relocation and loading
It allocates the space for program in the memory, by
calculating the size of the program. This activity is
called allocation.
CONT…
It resolves the symbolic reference (code/data) between
the object modules by assigning all the user subroutine
and library subroutine addresses. This activity is called
linking
There are some address dependant locations in the program, suchThere are some address dependant locations in the program, such
address constants must be adjusted according to allocated space,
such activity done by loader is called relocation.
Finally it places all the machine instruction and data of corresponding
programs and subroutines into the memory .Thus program now become ready
for execution, this activity is called loading.
General loading scheme diagram-
object
Program moduls A and B are
loaded in memory after linking.
It is ready for execution.
Module A
Object
Module B
LOADER A
B
CONT…
The following terminology is used to refer to the address
to refer to the address of the program entity at different
times
Translation time(or translated) address : address
assigned by the translator
Linked address : address by the linker
load time(or load) address : address assigned by the
loader.loader.
CONT…
o The same prefixes above are used with the origin and
execution start address of a program. thus,-
1. Translated origin :
Address of the origin assumed by the translator .This is the address
specified by the programmer in an ORIGIN statement.
2. Linked Origin :2. Linked Origin :
Address of the origin assigned by the linker while producing a
binary program.
3. Load Origin :
Address of the origin assigned by the loader while loading the
program for execution.
TYPES OF LOADERS
1. General Loader
2. Bootstrap Loader (Absolute Loader)
3. Subroutine Linkage
4. Relocating Loaders
4.1- Relocation bits
4.2- Relocation maps (modification records)
5. Direct Linking Loader
GENERAL LOADERS
In this scheme ,the source program is converted to object program
by translator (assembler).
The loader accepts these modules and puts machine instruction and
data in an executable form at their assigned memory.
Advantages:-
The program need not be retranslated each time while running it.The program need not be retranslated each time while running it.
There is no wastage of memory.
It is possible to write source program with multiple programs and
multiple languages.
ASSEMBLE-&-GO LOADER
Characteristics
The Object Code is stored in Memory after Assembly.
Single JUMP Instruction.
Advantage
Simple, Developing Environment.
Disadvantage
Whenever the Assembly Program is to be executed, it has to be
assembled again.
Programs have to be coded in the same language.
ABSOLUTE LOADER
It is kind of loader in which relocated object files are created
,loader accepts these files and places them at specified locations
in the memory.
This type of loader is called absolute because no relocation
information is needed; rather it is obtained from the programmerinformation is needed; rather it is obtained from the programmer
or assembler.
The task of an absolute loader is virtually trivial. The simply
accepts the machine language code produced by an assembler
and places it into main memory at the location specified by the
assembler.
ABSOLUTE LOADER
If the operating system loads the loader, how the operating
system itself loaded into memory?
Given an idle computer with no program in
memory, how do we gets things started?
Memory empty ⇒ no need for program relocation =>Memory empty ⇒ no need for program relocation =>
OS kernel is loaded into a predefined location in memory by
absolute loader
This absolute loader may be a software function, resident in
ROM or “primary loaded” by some hardware function.
ABSOLUTE LOADER
Absolute Loader accepts machine language code produced
by an assembler & places it into main memory at the
location specified by the assembler.
Absolute loader example –
The main program is assigned to location 100 to 250 and
the function F1 is assigned location 400 to 500. The
programmer should be careful not to assign overlappingprogrammer should be careful not to assign overlapping
location to modules to be linked.
ABSOLUTE LOADER
ABSOLUTE LOADER – ADVANTAGE & DISADVANTAGE
Advantages
Simple and Efficient.
No reallocation information is required , so the size of
the object module is comparatively small.
It makes memory available for loading, since the
assembler is not in memory at the time of loading.
No modification of address sensitive entities isNo modification of address sensitive entities is
required & it supports multiple object modules.
CONT..
Disadvantages
The need for programmer to specify the actual
address.
Difficult to use Subroutine libraries.
The programmer has to be careful not to assignThe programmer has to be careful not to assign
overlapping location to modules to be linked.
Lot of memory lying between modules will be
wasted.
If changes are made to one module that increses it
size then it can overlap the start of another module.
It may required manual shifting of module.this
manual shifting can become very complex and
tedios.
ALGORITHM FOR AN ABSOLUTE LOADER
Begin
read Header record
verify program name and length
read first Text record
while record type is not ‘E’ dowhile record type is not ‘E’ do
begin
{if object code is in character form, convert into internal
representation}
move object code to specified location in memory
read next object program record
end
jump to address specified in End record
end
ALGORITHM.
intialize
Read record
type=0 type=1Card
type
Mover binary image
at the address
specified in the record
Transfer the control
to the entry point
DESIGN.
In absolute loading scheme the programmer and
the assembler perform the following tasks.
1) Allocation
2) Relocation
3) Linking3) Linking
4) Loading
The absolute loader reads the object program
line by line and moves the text of the program
in to the memory at the location specified by the
assembler.
CONT.
The object program generated by the assembler
must communicate the following information to
the loader.
1) It must convey the machine instructions that
the assembler has created along with thethe assembler has created along with the
memory address.
2) It must convey the starting execution
point.program execution will start at this point
after the program is loaded.
CONT.
The object program is a sequence of object record.
Each object record specifies some specific aspect
of the program in the object module.
There are two types of record:
1) Text record containing binary image of the1) Text record containing binary image of the
assembly program
2) Transfer record containing the starting point of
execution.
CONT..
•TEXT RECORD
Record type
Number bytes of
information
Memory
address
Binary image of
data or instruction
•TRANSFER RECORD
Record type
Number of bytes of
information =0
Address of entry
point
SUBROUTINE LINKAGE
A program consisting of main program and a set
of function(subroutine) could reside in several
files.
The problem of subroutine linkage is this: A main
program a wishesh to call the subroutine B and ifprogram a wishesh to call the subroutine B and if
the subroutine B resides in another file then the
assembler will not know the address of B and
declare it as an undefined symbol.
To realize such interreaction,A and B must
contain public definition and external references.
EXTERN STATEMENT
The EXTERN statement lists the symbol to
which external references are made in the
current program unit. These symbols are defined
in other program units.
ENTRY STATEMENT
The ENTRY statement lists the public definition
of a program unit, i.e. it lists those symbols
defined in the program unit which may be
referenced in other program units.
RELOCATING LOADERS
When a single subroutine is changed then all the
subroutines need to be reassembled. The task of
allocation and linking must be carried out once again.
To avoid this rework a new class of loaders is
introduced which is called as relocating of loaders.
Two methods for specifying relocation
◦ Modification record
◦ Relocation bit
Each instruction is associated with one relocation bit.
These relocation bits in a Text record is gathered
into bit masks.
RELOCATING LOADERS (CONTD.)
Absolute loader loads a program on a specific memory
location, but it is often desirable to have two or more
programs residing in memory sharing the different
resources of a computer system.
It would be impractical to assign starting addresses toIt would be impractical to assign starting addresses to
each program to plan program execution.
A loader able to load a program into memory wherever
there is room for it is called a Relocating Loader.
MODIFICATION RECORD
Interleaving relocation bits with the program text makes
cumbersome the
process of loading the text directly into memory.
This problem can be resolve by collecting all relocation bits into a
single
contiguous relocation map that we will call the relocation sectioncontiguous relocation map that we will call the relocation section
of the
object code file.
The relocation section will be appended to the text and data
sections.
The header will contain the entry point and length of the relocation
section
in the object module.
RELOCATION BIT
Used for simple machines.
Relocation bit
0: no modification is necessary
1: modification is needed
Twelve-bit mask is used in each Text recordTwelve-bit mask is used in each Text record
Since each text record contains less than 12 words
Unused words are set to 0
Any value that is to be modified during relocation must
coincide with one of these 3-byte segments.
DIRECT LINKING LOADER
It is a general relocated loader and is perhaps
the most popular loading scheme presently
used.
1. It is a relocatable loader
2. It allows multiple procedure segments and2. It allows multiple procedure segments and
multiple data segment.
The assembler must give the loader the
following information with each procedure or
data segment
CONT..
The assembler must give the loader the following
information with each procedure or data segment
1. The lengthss of segment.
2. A list of symbols defined in the current segment
that may be referenced by other segments-that may be referenced by other segments-
public declaration.
3. A list of all symbols not defined in the segment
but referenced in the segment-external
variables.
4. Information about address constants.
5. The machine code translation of source program
and the relative addresses assigned.
CONT
The object module produced by the assembler is
divided into 4 sections:
1. External symbol directory(ESD)
2. Actual assembled program(TXT)
3. Relocation directory(RLD)3. Relocation directory(RLD)
4. End of the object module(END)
EXTERNAL SYMBOL DIRECTORY(ESD)
It contains information about all symbol that are
defined in this program but may be refrenced by
other programs.it also contains symbols
referenced in this program but defined in other
program.program.
CONT..
LC
1. MAIN START 0
2. ENTRY RESULT -
3. EXTRN SUM -
4. -4. -
5. -
6. -
7. -
8. -
9. -
10. RESULT DS 4 32
END 36
CONT..
Line no. Symbol type relative location length
1. MAIN SD 0 36
2. RESULT LD 32 -
3. SUM ER - -
SD- symbol is asegment definition
LD- symbol is defined in this program but it can
be referenced by other program.
ER- symbol is an external reference,it is defined
in some external program.
CONT..
• The relative location of the program (MAIN) is 0
and size is 36.
• The symbol RESULT is locally defined(LD) and
relative address is 32
• The symbol SUM is an external reference(ER).• The symbol SUM is an external reference(ER).
ACTUAL ASSEMBLED PROGRAM(TXT)
Text portion of object module contain the
relocatable machine language instruction and
data that were produced during translation.
RELOCATION DIRECTORY(RLD)
It contains one entry for each address that must
be changed when the module is loaded into main
memory.
The relocation directory contains the following
information:information:
1. The address of each operand that needs to be
changed due to relocation.
2. By what it has to be changed
3. The operation to be performed
END OF OBJECT MODULE(END)
This indicated the end of object module.
DESIGN OF DIRECT LINKING LOADER
The design of adirect linking loader is more
complicated than that of the absolute loader.
The input to the loader is set of object
programs(generated by assembler/compiler) to be
linked together. Each object module is divided inlinked together. Each object module is divided in
to four section:
1. External symbol directory(ESD)
2. Actual assembled progrsm containing the
binary code(TXT)
3. Relocation directory(RLD)
4. End of the object module(END)
CONT…
A direct linking loader requires two passes to
compelete the linking processes:
1. Pass 1,assigns addresses to all external symbol.
2. Pass 2,performs actual loading,relocation and
linking.linking.
In pass 1 , aglobal external symbol table(GEST)
is prepared.it contains every exrernal symbol
and the corresponding absolute address value.
CONT…
The two-pass limking loader scheme in shown
below:
Object
module
Copy of object
records
main
memory
Pass 1 of
loader
Object
module
Global external
symbol table
Pass 2 of
loader
LINKER FOR MS DOS
OBJECT MODULE FORMAT
MS DOS compiler & assembler produces object modules. The
object module is a sequence of object records.
There are 14 types of object records containing the following 5
basic categories of information:-
1) Binary image (i.e. code generated by a translator)
2) External references.2) External references.
3) Public definitions.
4) Debugging information (e.g. line number in source program).
5) Miscellaneous information (e.g. comments in the source
program).
We only consider the object record corresponding to first three
Categories - a total of 8 record types
OBJECT RECORDS OF INTEL 8088
1.THEADER RECORDS
The module name in THEADER record is typically derived
by the translator from the source file name.
This name is used by the linker to report errors.
80H length T-module name Check-sum
2.LNAMES RECORDS
An assembly programmer can specify the module name
in NAME directive.
This record lists the names for use by SEGDEF records.
96H length Name list Check-sum
3. SEGDEF RECORDS
This record designates a segment name using an index
into LNAMES list.
Attribute field indicates whether the segment is
rellocatable or absolute, whether (and in what manner )
it can be combined with other segments as also theit can be combined with other segments as also the
alignment requirement of its base address.
98H Length
Attributes
(1-4)
Check-sum
Segment Length
(2)
Name
Index
(1)
SEGDEF RECORDS
Stack segments with the same name are concatenated
with each other, while common segments with the same
name are overlapped with one another.
The attribute field also contains the origin specification
for an absolute segment.for an absolute segment.
4. EXTDEF RECORDS
This record contains a list of external references used by
the programs of this module.
A FIXUPP record designates an external symbols name
by using an index into this list.
8CH Length External Reference List Check-sum
5. PUBDEF RECORDS
It contains the list of public names declared in a
segment of the object module.
The base specification identifies the segment.
Each (name, offset) pair in the record definesEach (name, offset) pair in the record defines
one public name, specifying the name of the
symbol and its offset within the segment
designed by the base specification.
90H Length Base(2-4) Name Offset(2) ..... Check-sum
6. LEDATA RECORDS
It contains the binary image of the code generated by
the language translator.
Segment index identifies the segment to which the code
belongs, and offset specifies the location of the code
within the segment.within the segment.
A0H Length Segment index(1-2) Data offset(2) Data Check-sum
7. FIXUPP RECORDS
It contains information for one or more relocation and
linking fixups to be performed.
The locat field contains a numeric code called loc code
to indicate the type of a fixup.
The meanings of these codes are given below:The meanings of these codes are given below:
9CH Length Locate(1) Fix dat
Frame
datum(1)
Target
datum(1)
Target
offset(2)
… Check sum
CONT……
Locat also contains the offset of the fixup location in the
previous LEDATA record.
The frame datum field , which refers to a SEGDEF record ,
identifies the segment to which the fixup location belongs.
The target datum and target offset fields specify theThe target datum and target offset fields specify the
relocation or linking information.
target datum contains a segment index or an external index,
while target offset contains an offset from the name
indicated in target datum.
The fix dat field indicates the manner in which the target
datum and target offset fields are to be interpreted.
The numeric codes used for this purpose are given below
SOFTWARE TOOLS FOR PROGRAMMING DEVELOPMENT
A software tool is system program which Interfaces a
program with the entity generating its input data or
interfaces the results of a program with the entity
consuming them.
CONT..
The software tools include:-
Assembler
Linker
Loader
Macro processor
Text editorText editor
Compiler
Operating system
Debugging system
Source Code Control System
(Optional) Database Management System
User Interface
A SOFTWARE TOOL
originator Software
tool
Consumer
Raw program or
data
Transformed program or data
FUNDAMENTAL STEPS IN PROGRAM
DEVELOPMENT
Program design, coding, documentation.
Preparation of programs in machine readable
form.
Program translation, linking and loading.
Program testing and debugging.Program testing and debugging.
Performance tuning.
Reformatting the data and results of a program
to suit other programs.
PROGRAM DESIGN AND CODING
Two categories of tools used in program design and
coding are :
Program generators :
A program generator generates a program which
performs a set of functions described in its
specification. Coding effort is saved since the program
performs a set of functions described in its
specification. Coding effort is saved since the program
is generated rather than coded by hand.
Programming environments :
A programming environment supports program
coding by incorporating awareness of the
programming language syntax and semantics in the
language editor.
PROGRAM ENTRY AND EDITING
These tools are text editors or more sophisticated
programs with text editors as front ends. The
editor functions in two modes. In the command
mode, it accepts user commands specifying the
editing function to be performed. In the dataediting function to be performed. In the data
mode, the user keys in the text to be added to the
file.
Failure to recognize the current mode of the
editor can lead to mix up of command and data.
This can be avoided by providing a quick exit e.g.
escape key, such that the editor enters the
command mode.
PROGRAM TESTING & DEBUGGING
Important steps in program testing and
debugging are selection of test data for the
program, analysis of test results to detect errors
and debugging, i.e. localization and removal of
errors. Software tools to assist the programmer
come in following form :come in following form :
1. Test data generators help the user in selecting
test data for his program. Their use helps in
ensuring that a program is thoroughly tested.
2. Automated test drivers help in regression
testing, wherein a programs correctness is
verified by subjecting it to a standard set of
tests after every modification.
CONT..
Regression testing is performed as follows: Many
sets of test data are prepared for a program.
These are given as inputs to the test driver. The
driver selects one set of test data at a time and
organizes execution of the program on the data.organizes execution of the program on the data.
4. Debug monitors help in obtaining information for
localization of errors.
5. Source code control system help to keep track of
modifications in the source code.
DEBUGGING MONITOR
An interactive debugging system provides programmers with
facilities that aid in the testing & debugging of programs.
Debug monitors provide following facilities:-
1. Setting Breakpoints
2. Initiating debug conversations
3. Single-stepping3. Single-stepping
4. Inspection & Assignment of variables
Debugging system provides functions such as tracing & trace
back.
Tracing can be used to track flow of execution logic & data
modification.
While debugging a program, user specifies a list of
breakpoints & actions to be performed at breakpoints. Debug
monitor builds a table containing statement no. & debug
action.
ENHANCEMENT OF PROGRAM
PERFORMANCE
A profile monitor is a software tool that collects
information regarding the execution behavior of a
program, e.g. the amount of execution time
consumed by its modules, and presents in the
form of an execution profile.form of an execution profile.
Program efficiency depends on two factors :
1. The efficiency of the algorithm.
2. The efficiency of its coding.
3. An optimizing compiler can improve efficiency
of the code but it cannot improve efficiency of
the algorithm.
PROGRAM DOCUMENTATION
Most programming projects suffer from lack of up
to date documentation. Automatic documentation
tools are motivated by the desire to overcome this
deficiency. These tools work on the source
program to produce different forms ofprogram to produce different forms of
documentation, e.g. flow charts, IO specifications
showing files and their records, etc.
DESIGN OF SOFTWARE TOOLS
Program preprocessing techniques are used to
support static analysis of programs. Tools
generating cross reference listings and lists of
unreferenced symbols; test data generators, and
documentation aids use this technique.documentation aids use this technique.
Program instrumentation implies insertion of
statements in a program. The instrumented
program is translated using standard translator.
SOFTWARE TOOLS USING INTERPRETATION & PROGRAM GENERATION
InterpreterTask
specification
Results
Data
Program GeneratedProgram
Generator
Task specification Generated
program
Data
Results
EDITORS
Text editors come in the following forms :
1. Line editors.
2. Stream editors.
3. Screen editors.
Word processors.4. Word processors.
5. Structure editors
EDITOR
The scope of edit operations in a line editor is limited
to a line of text. The primary advantage of line editors
is there simplicity.
A stream editor views the entire text as a stream of
characters. This permits edit operations to cross line
boundaries. Stream editors typically support
character, line and context oriented commands basedcharacter, line and context oriented commands based
on the current editing context indicated by the
position of a text pointer.
Screen editors display a screenful of text at a time.
The user can move the cursor over the screen,
position it at the point where he desires to perform
some editing and proceed with the editing directly.
Thus it is possible to see the effect of an edit operation
on the screen. This is very useful while formatting the
text to produce printed documents.
EDITOR
Word processors are basically document editors
with additional features to produce well
formatted hard copy output. Essential features of
word processors are commands for moving
sections of text from one place to another,
merging of text, and searching and replacementmerging of text, and searching and replacement
of words.
A structural editors incorporates an awareness of
the structure of a document. This is useful in
browsing through a document, e.g. if a
programmer wishes to edit a specific function in
a program file. The structure is specified by the
user while creating or modifying the document.
EDITOR STRUCTURE
Command
processor
Editing
manager
Viewing
manager
Travelling
manager
Viewing filter
Editing buffer
Viewing
buffer
Editing filter
Test
USER INTERFACES
A user interface plays a vital role in simplifying
the interaction of user with an
application.classically,UI functionalities have two
important aspects- issuing of commands and
exchange of data.exchange of data.
Hence an understanding commands and data
was implicit in the use of an application.
A UI can be visulized to consist of two compenent
a dialog manager and presentation manager
CONT…
A dialog manager manages the conversation
between the user and the application. This
involves prompting the user for a command and
transmitting the command to the application.
The presentation manager displays the dataThe presentation manager displays the data
produced by the application in an appropriate
manner on the user’s display or printer device.
COMMAND DIALOG
Command are issued to an application through a
command dialog. Three ways to implement
command dialogs are:
1) Command language
2) Command menus2) Command menus
3) Direct manipulation
Command language for computer application
are similar to command language for operating
system.
Primitive command language support
imperative commands with syntax<action>
<parameters>.sss
CONT..
Command menus provide obivous advantades to
the casual user of an application,as the basic
funcationalities of the application are reflected in
the menu choices.
A hierarchy of menus can be used to guide theA hierarchy of menus can be used to guide the
user into the details concerning a functionality.
CONT…
A direct manipulation system provides the user
with a visual display of the universe of the
application. The display shows the important
objects in the universe.
Actions or opreations over objects are indicatedActions or opreations over objects are indicated
using some kind of pointing device,
EG. A cursor or mouse.
PRINCIPLE OF COMMAND DIALOG DESIGN
1) Ease of use
2) Consistency in command structure
3) Immediate feedback on user commands
4) Error handling
On line help to avoid memorizing command5) On line help to avoid memorizing command
details
6) Undo facility
7) Shortcut for experienced users
STRUCTURE OF A USER INTERFACE
The UI consist of two main
compenents,presentation manager and dialog
manager.
Structure diagram for user interface:
Application
user
interface
user
Application
code
Graphics
package
Dialog
manager
Presentation
manager
USER INTERFACE MANAGEMENT SYSTEM
A user interface management system automates
the generation of user interface. UIMS accepts
specification of the presentation and dialog
semantics to produce the presentation and dialog
managers of the UI resp.managers of the UI resp.
In the following we describe two UIMS.
1) Menulay
2) hypercard
MENULAY
Menulay is an early UIMS using the screen
layout as the basis for the dialog model. The UI
designer starts by designing the user screen.
HYPERCARD
This UIMS from appale incorporates object
orientation in the event oriented approach.
A card has an associated screen layout containing
buttons and field.

Contenu connexe

Tendances

Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03desta_gebre
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1Manoj Patil
 
Direct linking loader
Direct linking loaderDirect linking loader
Direct linking loaderbabyparul
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit ISaranya1702
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programmingMukesh Tekwani
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language ProcessingHemant Sharma
 
Language processor
Language processorLanguage processor
Language processorAbha Damani
 
System Programming Unit II
System Programming Unit IISystem Programming Unit II
System Programming Unit IIManoj Patil
 
System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSARASWATHI S
 

Tendances (20)

System software
System softwareSystem software
System software
 
Ch 4 linker loader
Ch 4 linker loaderCh 4 linker loader
Ch 4 linker loader
 
Assemblers: Ch03
Assemblers: Ch03Assemblers: Ch03
Assemblers: Ch03
 
System Programing Unit 1
System Programing Unit 1System Programing Unit 1
System Programing Unit 1
 
Macro Processor
Macro ProcessorMacro Processor
Macro Processor
 
Direct linking loader
Direct linking loaderDirect linking loader
Direct linking loader
 
Unit 4 sp macro
Unit 4 sp macroUnit 4 sp macro
Unit 4 sp macro
 
System Programming- Unit I
System Programming- Unit ISystem Programming- Unit I
System Programming- Unit I
 
Introduction to systems programming
Introduction to systems programmingIntroduction to systems programming
Introduction to systems programming
 
Macro assembler
 Macro assembler Macro assembler
Macro assembler
 
Fundamentals of Language Processing
Fundamentals of Language ProcessingFundamentals of Language Processing
Fundamentals of Language Processing
 
Direct linking loaders
Direct linking loadersDirect linking loaders
Direct linking loaders
 
Language processor
Language processorLanguage processor
Language processor
 
Linking in MS-Dos System
Linking in MS-Dos SystemLinking in MS-Dos System
Linking in MS-Dos System
 
MACRO PROCESSOR
MACRO PROCESSORMACRO PROCESSOR
MACRO PROCESSOR
 
Unit 2
Unit 2Unit 2
Unit 2
 
System Programming Overview
System Programming OverviewSystem Programming Overview
System Programming Overview
 
System Programming Unit II
System Programming Unit IISystem Programming Unit II
System Programming Unit II
 
System software - macro expansion,nested macro calls
System software - macro expansion,nested macro callsSystem software - macro expansion,nested macro calls
System software - macro expansion,nested macro calls
 
Unit 3 sp assembler
Unit 3 sp assemblerUnit 3 sp assembler
Unit 3 sp assembler
 

En vedette

Multi-Language Websites in ExpressionEngine
Multi-Language Websites in ExpressionEngineMulti-Language Websites in ExpressionEngine
Multi-Language Websites in ExpressionEngineJohn Henry Donovan
 
System programming note
System programming noteSystem programming note
System programming noteSANTOSH RATH
 
System Programming Unit IV
System Programming Unit IVSystem Programming Unit IV
System Programming Unit IVManoj Patil
 
System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit IIIManoj Patil
 

En vedette (6)

Multi-Language Websites in ExpressionEngine
Multi-Language Websites in ExpressionEngineMulti-Language Websites in ExpressionEngine
Multi-Language Websites in ExpressionEngine
 
System programming note
System programming noteSystem programming note
System programming note
 
System Programming Unit IV
System Programming Unit IVSystem Programming Unit IV
System Programming Unit IV
 
Loaders
LoadersLoaders
Loaders
 
Loader
LoaderLoader
Loader
 
System Programming Unit III
System Programming Unit IIISystem Programming Unit III
System Programming Unit III
 

Similaire à Unit 3 (20)

linker & loader presentation in Compiler Design
linker & loader presentation in Compiler Designlinker & loader presentation in Compiler Design
linker & loader presentation in Compiler Design
 
Loaders
LoadersLoaders
Loaders
 
Loaders and Linkers
Loaders and LinkersLoaders and Linkers
Loaders and Linkers
 
System software-loaders
System software-loadersSystem software-loaders
System software-loaders
 
Handout#12
Handout#12Handout#12
Handout#12
 
linkerloader ss-2.pptx
linkerloader ss-2.pptxlinkerloader ss-2.pptx
linkerloader ss-2.pptx
 
system prgramming - loaders-linkers.pdf
system prgramming - loaders-linkers.pdfsystem prgramming - loaders-linkers.pdf
system prgramming - loaders-linkers.pdf
 
Hm system programming class 1
Hm system programming class 1Hm system programming class 1
Hm system programming class 1
 
Linker and Loader Explained
Linker and Loader  ExplainedLinker and Loader  Explained
Linker and Loader Explained
 
Loaders
LoadersLoaders
Loaders
 
Introduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic conceptsIntroduction To C++ programming and its basic concepts
Introduction To C++ programming and its basic concepts
 
Embedded C.pptx
Embedded C.pptxEmbedded C.pptx
Embedded C.pptx
 
CS8251_QB_answers.pdf
CS8251_QB_answers.pdfCS8251_QB_answers.pdf
CS8251_QB_answers.pdf
 
Handout#11
Handout#11Handout#11
Handout#11
 
COMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONSCOMPILER DESIGN OPTIONS
COMPILER DESIGN OPTIONS
 
Compliers and interpreters
Compliers and interpretersCompliers and interpreters
Compliers and interpreters
 
Chapter1.pdf
Chapter1.pdfChapter1.pdf
Chapter1.pdf
 
Assembler
AssemblerAssembler
Assembler
 
Lect-01.ppt
Lect-01.pptLect-01.ppt
Lect-01.ppt
 
Translators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreterTranslators(Compiler, Assembler) and interpreter
Translators(Compiler, Assembler) and interpreter
 

Dernier

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Shubhangi Sonawane
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfAdmir Softic
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfChris Hunter
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Dernier (20)

Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Unit 3

  • 1. UNIT III LINKERS AND LOADERS AND SOFTWARE TOOLS Pre requisite :- Know the basic of fundamental of operating system. Outcomes Aim of this chapter students are aware with loader . Software tool
  • 2. UNIT III LINKERS AND LOADERS AND SOFTWARE TOOLS Contents : Basic loaders functions, central loaders scheme Absolute loaders, Subroutine linkers, relocation Loader, Direct linking loader, Dynamic linking loader, Design of absolute loaders direct linking loader, Implantation of MS DOS linker,Implantation of MS DOS linker, Software tools for program development, editors, debug monitor, programming environment, user interfaces.
  • 3. LINKERS AND LOADERS & SOFTWARE TOOLS Execution of program involves the following steps Translation of the programs . Linking of the program with other program needed for its execution. Relocation of the program to execute from the specific memory area allocated to it. Loading of the program in the memory for the purpose of execution .
  • 4. LINKERS & LOADERS & SOFTWARE TOOLS A schematic of Program execution Translator Linker Loader Binary Program Source Program Object Modules Binary Programs Control FlowData Flow
  • 5. FUNCTIONS OF LOADER Loader: The loader is a program which accepts object codes and prepares them for execution and initiates execution. The loader is responsible for the activities such asThe loader is responsible for the activities such as allocation ,linking, relocation and loading It allocates the space for program in the memory, by calculating the size of the program. This activity is called allocation.
  • 6. CONT… It resolves the symbolic reference (code/data) between the object modules by assigning all the user subroutine and library subroutine addresses. This activity is called linking There are some address dependant locations in the program, suchThere are some address dependant locations in the program, such address constants must be adjusted according to allocated space, such activity done by loader is called relocation.
  • 7. Finally it places all the machine instruction and data of corresponding programs and subroutines into the memory .Thus program now become ready for execution, this activity is called loading. General loading scheme diagram- object Program moduls A and B are loaded in memory after linking. It is ready for execution. Module A Object Module B LOADER A B
  • 8. CONT… The following terminology is used to refer to the address to refer to the address of the program entity at different times Translation time(or translated) address : address assigned by the translator Linked address : address by the linker load time(or load) address : address assigned by the loader.loader.
  • 9. CONT… o The same prefixes above are used with the origin and execution start address of a program. thus,- 1. Translated origin : Address of the origin assumed by the translator .This is the address specified by the programmer in an ORIGIN statement. 2. Linked Origin :2. Linked Origin : Address of the origin assigned by the linker while producing a binary program. 3. Load Origin : Address of the origin assigned by the loader while loading the program for execution.
  • 10. TYPES OF LOADERS 1. General Loader 2. Bootstrap Loader (Absolute Loader) 3. Subroutine Linkage 4. Relocating Loaders 4.1- Relocation bits 4.2- Relocation maps (modification records) 5. Direct Linking Loader
  • 11. GENERAL LOADERS In this scheme ,the source program is converted to object program by translator (assembler). The loader accepts these modules and puts machine instruction and data in an executable form at their assigned memory. Advantages:- The program need not be retranslated each time while running it.The program need not be retranslated each time while running it. There is no wastage of memory. It is possible to write source program with multiple programs and multiple languages.
  • 12. ASSEMBLE-&-GO LOADER Characteristics The Object Code is stored in Memory after Assembly. Single JUMP Instruction. Advantage Simple, Developing Environment. Disadvantage Whenever the Assembly Program is to be executed, it has to be assembled again. Programs have to be coded in the same language.
  • 13. ABSOLUTE LOADER It is kind of loader in which relocated object files are created ,loader accepts these files and places them at specified locations in the memory. This type of loader is called absolute because no relocation information is needed; rather it is obtained from the programmerinformation is needed; rather it is obtained from the programmer or assembler. The task of an absolute loader is virtually trivial. The simply accepts the machine language code produced by an assembler and places it into main memory at the location specified by the assembler.
  • 14. ABSOLUTE LOADER If the operating system loads the loader, how the operating system itself loaded into memory? Given an idle computer with no program in memory, how do we gets things started? Memory empty ⇒ no need for program relocation =>Memory empty ⇒ no need for program relocation => OS kernel is loaded into a predefined location in memory by absolute loader This absolute loader may be a software function, resident in ROM or “primary loaded” by some hardware function.
  • 15. ABSOLUTE LOADER Absolute Loader accepts machine language code produced by an assembler & places it into main memory at the location specified by the assembler. Absolute loader example – The main program is assigned to location 100 to 250 and the function F1 is assigned location 400 to 500. The programmer should be careful not to assign overlappingprogrammer should be careful not to assign overlapping location to modules to be linked.
  • 17. ABSOLUTE LOADER – ADVANTAGE & DISADVANTAGE Advantages Simple and Efficient. No reallocation information is required , so the size of the object module is comparatively small. It makes memory available for loading, since the assembler is not in memory at the time of loading. No modification of address sensitive entities isNo modification of address sensitive entities is required & it supports multiple object modules.
  • 18. CONT.. Disadvantages The need for programmer to specify the actual address. Difficult to use Subroutine libraries. The programmer has to be careful not to assignThe programmer has to be careful not to assign overlapping location to modules to be linked. Lot of memory lying between modules will be wasted. If changes are made to one module that increses it size then it can overlap the start of another module. It may required manual shifting of module.this manual shifting can become very complex and tedios.
  • 19. ALGORITHM FOR AN ABSOLUTE LOADER Begin read Header record verify program name and length read first Text record while record type is not ‘E’ dowhile record type is not ‘E’ do begin {if object code is in character form, convert into internal representation} move object code to specified location in memory read next object program record end jump to address specified in End record end
  • 20. ALGORITHM. intialize Read record type=0 type=1Card type Mover binary image at the address specified in the record Transfer the control to the entry point
  • 21. DESIGN. In absolute loading scheme the programmer and the assembler perform the following tasks. 1) Allocation 2) Relocation 3) Linking3) Linking 4) Loading The absolute loader reads the object program line by line and moves the text of the program in to the memory at the location specified by the assembler.
  • 22. CONT. The object program generated by the assembler must communicate the following information to the loader. 1) It must convey the machine instructions that the assembler has created along with thethe assembler has created along with the memory address. 2) It must convey the starting execution point.program execution will start at this point after the program is loaded.
  • 23. CONT. The object program is a sequence of object record. Each object record specifies some specific aspect of the program in the object module. There are two types of record: 1) Text record containing binary image of the1) Text record containing binary image of the assembly program 2) Transfer record containing the starting point of execution.
  • 24. CONT.. •TEXT RECORD Record type Number bytes of information Memory address Binary image of data or instruction •TRANSFER RECORD Record type Number of bytes of information =0 Address of entry point
  • 25. SUBROUTINE LINKAGE A program consisting of main program and a set of function(subroutine) could reside in several files. The problem of subroutine linkage is this: A main program a wishesh to call the subroutine B and ifprogram a wishesh to call the subroutine B and if the subroutine B resides in another file then the assembler will not know the address of B and declare it as an undefined symbol. To realize such interreaction,A and B must contain public definition and external references.
  • 26. EXTERN STATEMENT The EXTERN statement lists the symbol to which external references are made in the current program unit. These symbols are defined in other program units.
  • 27. ENTRY STATEMENT The ENTRY statement lists the public definition of a program unit, i.e. it lists those symbols defined in the program unit which may be referenced in other program units.
  • 28. RELOCATING LOADERS When a single subroutine is changed then all the subroutines need to be reassembled. The task of allocation and linking must be carried out once again. To avoid this rework a new class of loaders is introduced which is called as relocating of loaders. Two methods for specifying relocation ◦ Modification record ◦ Relocation bit Each instruction is associated with one relocation bit. These relocation bits in a Text record is gathered into bit masks.
  • 29. RELOCATING LOADERS (CONTD.) Absolute loader loads a program on a specific memory location, but it is often desirable to have two or more programs residing in memory sharing the different resources of a computer system. It would be impractical to assign starting addresses toIt would be impractical to assign starting addresses to each program to plan program execution. A loader able to load a program into memory wherever there is room for it is called a Relocating Loader.
  • 30. MODIFICATION RECORD Interleaving relocation bits with the program text makes cumbersome the process of loading the text directly into memory. This problem can be resolve by collecting all relocation bits into a single contiguous relocation map that we will call the relocation sectioncontiguous relocation map that we will call the relocation section of the object code file. The relocation section will be appended to the text and data sections. The header will contain the entry point and length of the relocation section in the object module.
  • 31. RELOCATION BIT Used for simple machines. Relocation bit 0: no modification is necessary 1: modification is needed Twelve-bit mask is used in each Text recordTwelve-bit mask is used in each Text record Since each text record contains less than 12 words Unused words are set to 0 Any value that is to be modified during relocation must coincide with one of these 3-byte segments.
  • 32. DIRECT LINKING LOADER It is a general relocated loader and is perhaps the most popular loading scheme presently used. 1. It is a relocatable loader 2. It allows multiple procedure segments and2. It allows multiple procedure segments and multiple data segment. The assembler must give the loader the following information with each procedure or data segment
  • 33. CONT.. The assembler must give the loader the following information with each procedure or data segment 1. The lengthss of segment. 2. A list of symbols defined in the current segment that may be referenced by other segments-that may be referenced by other segments- public declaration. 3. A list of all symbols not defined in the segment but referenced in the segment-external variables. 4. Information about address constants. 5. The machine code translation of source program and the relative addresses assigned.
  • 34. CONT The object module produced by the assembler is divided into 4 sections: 1. External symbol directory(ESD) 2. Actual assembled program(TXT) 3. Relocation directory(RLD)3. Relocation directory(RLD) 4. End of the object module(END)
  • 35. EXTERNAL SYMBOL DIRECTORY(ESD) It contains information about all symbol that are defined in this program but may be refrenced by other programs.it also contains symbols referenced in this program but defined in other program.program.
  • 36. CONT.. LC 1. MAIN START 0 2. ENTRY RESULT - 3. EXTRN SUM - 4. -4. - 5. - 6. - 7. - 8. - 9. - 10. RESULT DS 4 32 END 36
  • 37. CONT.. Line no. Symbol type relative location length 1. MAIN SD 0 36 2. RESULT LD 32 - 3. SUM ER - - SD- symbol is asegment definition LD- symbol is defined in this program but it can be referenced by other program. ER- symbol is an external reference,it is defined in some external program.
  • 38. CONT.. • The relative location of the program (MAIN) is 0 and size is 36. • The symbol RESULT is locally defined(LD) and relative address is 32 • The symbol SUM is an external reference(ER).• The symbol SUM is an external reference(ER).
  • 39. ACTUAL ASSEMBLED PROGRAM(TXT) Text portion of object module contain the relocatable machine language instruction and data that were produced during translation.
  • 40. RELOCATION DIRECTORY(RLD) It contains one entry for each address that must be changed when the module is loaded into main memory. The relocation directory contains the following information:information: 1. The address of each operand that needs to be changed due to relocation. 2. By what it has to be changed 3. The operation to be performed
  • 41. END OF OBJECT MODULE(END) This indicated the end of object module.
  • 42. DESIGN OF DIRECT LINKING LOADER The design of adirect linking loader is more complicated than that of the absolute loader. The input to the loader is set of object programs(generated by assembler/compiler) to be linked together. Each object module is divided inlinked together. Each object module is divided in to four section: 1. External symbol directory(ESD) 2. Actual assembled progrsm containing the binary code(TXT) 3. Relocation directory(RLD) 4. End of the object module(END)
  • 43. CONT… A direct linking loader requires two passes to compelete the linking processes: 1. Pass 1,assigns addresses to all external symbol. 2. Pass 2,performs actual loading,relocation and linking.linking. In pass 1 , aglobal external symbol table(GEST) is prepared.it contains every exrernal symbol and the corresponding absolute address value.
  • 44. CONT… The two-pass limking loader scheme in shown below: Object module Copy of object records main memory Pass 1 of loader Object module Global external symbol table Pass 2 of loader
  • 45. LINKER FOR MS DOS OBJECT MODULE FORMAT MS DOS compiler & assembler produces object modules. The object module is a sequence of object records. There are 14 types of object records containing the following 5 basic categories of information:- 1) Binary image (i.e. code generated by a translator) 2) External references.2) External references. 3) Public definitions. 4) Debugging information (e.g. line number in source program). 5) Miscellaneous information (e.g. comments in the source program). We only consider the object record corresponding to first three Categories - a total of 8 record types
  • 46. OBJECT RECORDS OF INTEL 8088
  • 47. 1.THEADER RECORDS The module name in THEADER record is typically derived by the translator from the source file name. This name is used by the linker to report errors. 80H length T-module name Check-sum
  • 48. 2.LNAMES RECORDS An assembly programmer can specify the module name in NAME directive. This record lists the names for use by SEGDEF records. 96H length Name list Check-sum
  • 49. 3. SEGDEF RECORDS This record designates a segment name using an index into LNAMES list. Attribute field indicates whether the segment is rellocatable or absolute, whether (and in what manner ) it can be combined with other segments as also theit can be combined with other segments as also the alignment requirement of its base address. 98H Length Attributes (1-4) Check-sum Segment Length (2) Name Index (1)
  • 50. SEGDEF RECORDS Stack segments with the same name are concatenated with each other, while common segments with the same name are overlapped with one another. The attribute field also contains the origin specification for an absolute segment.for an absolute segment.
  • 51. 4. EXTDEF RECORDS This record contains a list of external references used by the programs of this module. A FIXUPP record designates an external symbols name by using an index into this list. 8CH Length External Reference List Check-sum
  • 52. 5. PUBDEF RECORDS It contains the list of public names declared in a segment of the object module. The base specification identifies the segment. Each (name, offset) pair in the record definesEach (name, offset) pair in the record defines one public name, specifying the name of the symbol and its offset within the segment designed by the base specification. 90H Length Base(2-4) Name Offset(2) ..... Check-sum
  • 53. 6. LEDATA RECORDS It contains the binary image of the code generated by the language translator. Segment index identifies the segment to which the code belongs, and offset specifies the location of the code within the segment.within the segment. A0H Length Segment index(1-2) Data offset(2) Data Check-sum
  • 54. 7. FIXUPP RECORDS It contains information for one or more relocation and linking fixups to be performed. The locat field contains a numeric code called loc code to indicate the type of a fixup. The meanings of these codes are given below:The meanings of these codes are given below: 9CH Length Locate(1) Fix dat Frame datum(1) Target datum(1) Target offset(2) … Check sum
  • 55. CONT…… Locat also contains the offset of the fixup location in the previous LEDATA record. The frame datum field , which refers to a SEGDEF record , identifies the segment to which the fixup location belongs. The target datum and target offset fields specify theThe target datum and target offset fields specify the relocation or linking information. target datum contains a segment index or an external index, while target offset contains an offset from the name indicated in target datum. The fix dat field indicates the manner in which the target datum and target offset fields are to be interpreted. The numeric codes used for this purpose are given below
  • 56. SOFTWARE TOOLS FOR PROGRAMMING DEVELOPMENT A software tool is system program which Interfaces a program with the entity generating its input data or interfaces the results of a program with the entity consuming them.
  • 57. CONT.. The software tools include:- Assembler Linker Loader Macro processor Text editorText editor Compiler Operating system Debugging system Source Code Control System (Optional) Database Management System User Interface
  • 58. A SOFTWARE TOOL originator Software tool Consumer Raw program or data Transformed program or data
  • 59. FUNDAMENTAL STEPS IN PROGRAM DEVELOPMENT Program design, coding, documentation. Preparation of programs in machine readable form. Program translation, linking and loading. Program testing and debugging.Program testing and debugging. Performance tuning. Reformatting the data and results of a program to suit other programs.
  • 60. PROGRAM DESIGN AND CODING Two categories of tools used in program design and coding are : Program generators : A program generator generates a program which performs a set of functions described in its specification. Coding effort is saved since the program performs a set of functions described in its specification. Coding effort is saved since the program is generated rather than coded by hand. Programming environments : A programming environment supports program coding by incorporating awareness of the programming language syntax and semantics in the language editor.
  • 61. PROGRAM ENTRY AND EDITING These tools are text editors or more sophisticated programs with text editors as front ends. The editor functions in two modes. In the command mode, it accepts user commands specifying the editing function to be performed. In the dataediting function to be performed. In the data mode, the user keys in the text to be added to the file. Failure to recognize the current mode of the editor can lead to mix up of command and data. This can be avoided by providing a quick exit e.g. escape key, such that the editor enters the command mode.
  • 62. PROGRAM TESTING & DEBUGGING Important steps in program testing and debugging are selection of test data for the program, analysis of test results to detect errors and debugging, i.e. localization and removal of errors. Software tools to assist the programmer come in following form :come in following form : 1. Test data generators help the user in selecting test data for his program. Their use helps in ensuring that a program is thoroughly tested. 2. Automated test drivers help in regression testing, wherein a programs correctness is verified by subjecting it to a standard set of tests after every modification.
  • 63. CONT.. Regression testing is performed as follows: Many sets of test data are prepared for a program. These are given as inputs to the test driver. The driver selects one set of test data at a time and organizes execution of the program on the data.organizes execution of the program on the data. 4. Debug monitors help in obtaining information for localization of errors. 5. Source code control system help to keep track of modifications in the source code.
  • 64. DEBUGGING MONITOR An interactive debugging system provides programmers with facilities that aid in the testing & debugging of programs. Debug monitors provide following facilities:- 1. Setting Breakpoints 2. Initiating debug conversations 3. Single-stepping3. Single-stepping 4. Inspection & Assignment of variables Debugging system provides functions such as tracing & trace back. Tracing can be used to track flow of execution logic & data modification. While debugging a program, user specifies a list of breakpoints & actions to be performed at breakpoints. Debug monitor builds a table containing statement no. & debug action.
  • 65. ENHANCEMENT OF PROGRAM PERFORMANCE A profile monitor is a software tool that collects information regarding the execution behavior of a program, e.g. the amount of execution time consumed by its modules, and presents in the form of an execution profile.form of an execution profile. Program efficiency depends on two factors : 1. The efficiency of the algorithm. 2. The efficiency of its coding. 3. An optimizing compiler can improve efficiency of the code but it cannot improve efficiency of the algorithm.
  • 66. PROGRAM DOCUMENTATION Most programming projects suffer from lack of up to date documentation. Automatic documentation tools are motivated by the desire to overcome this deficiency. These tools work on the source program to produce different forms ofprogram to produce different forms of documentation, e.g. flow charts, IO specifications showing files and their records, etc.
  • 67. DESIGN OF SOFTWARE TOOLS Program preprocessing techniques are used to support static analysis of programs. Tools generating cross reference listings and lists of unreferenced symbols; test data generators, and documentation aids use this technique.documentation aids use this technique. Program instrumentation implies insertion of statements in a program. The instrumented program is translated using standard translator.
  • 68. SOFTWARE TOOLS USING INTERPRETATION & PROGRAM GENERATION InterpreterTask specification Results Data Program GeneratedProgram Generator Task specification Generated program Data Results
  • 69. EDITORS Text editors come in the following forms : 1. Line editors. 2. Stream editors. 3. Screen editors. Word processors.4. Word processors. 5. Structure editors
  • 70. EDITOR The scope of edit operations in a line editor is limited to a line of text. The primary advantage of line editors is there simplicity. A stream editor views the entire text as a stream of characters. This permits edit operations to cross line boundaries. Stream editors typically support character, line and context oriented commands basedcharacter, line and context oriented commands based on the current editing context indicated by the position of a text pointer. Screen editors display a screenful of text at a time. The user can move the cursor over the screen, position it at the point where he desires to perform some editing and proceed with the editing directly. Thus it is possible to see the effect of an edit operation on the screen. This is very useful while formatting the text to produce printed documents.
  • 71. EDITOR Word processors are basically document editors with additional features to produce well formatted hard copy output. Essential features of word processors are commands for moving sections of text from one place to another, merging of text, and searching and replacementmerging of text, and searching and replacement of words. A structural editors incorporates an awareness of the structure of a document. This is useful in browsing through a document, e.g. if a programmer wishes to edit a specific function in a program file. The structure is specified by the user while creating or modifying the document.
  • 73. USER INTERFACES A user interface plays a vital role in simplifying the interaction of user with an application.classically,UI functionalities have two important aspects- issuing of commands and exchange of data.exchange of data. Hence an understanding commands and data was implicit in the use of an application. A UI can be visulized to consist of two compenent a dialog manager and presentation manager
  • 74. CONT… A dialog manager manages the conversation between the user and the application. This involves prompting the user for a command and transmitting the command to the application. The presentation manager displays the dataThe presentation manager displays the data produced by the application in an appropriate manner on the user’s display or printer device.
  • 75. COMMAND DIALOG Command are issued to an application through a command dialog. Three ways to implement command dialogs are: 1) Command language 2) Command menus2) Command menus 3) Direct manipulation Command language for computer application are similar to command language for operating system. Primitive command language support imperative commands with syntax<action> <parameters>.sss
  • 76. CONT.. Command menus provide obivous advantades to the casual user of an application,as the basic funcationalities of the application are reflected in the menu choices. A hierarchy of menus can be used to guide theA hierarchy of menus can be used to guide the user into the details concerning a functionality.
  • 77. CONT… A direct manipulation system provides the user with a visual display of the universe of the application. The display shows the important objects in the universe. Actions or opreations over objects are indicatedActions or opreations over objects are indicated using some kind of pointing device, EG. A cursor or mouse.
  • 78. PRINCIPLE OF COMMAND DIALOG DESIGN 1) Ease of use 2) Consistency in command structure 3) Immediate feedback on user commands 4) Error handling On line help to avoid memorizing command5) On line help to avoid memorizing command details 6) Undo facility 7) Shortcut for experienced users
  • 79. STRUCTURE OF A USER INTERFACE The UI consist of two main compenents,presentation manager and dialog manager. Structure diagram for user interface: Application user interface user Application code Graphics package Dialog manager Presentation manager
  • 80. USER INTERFACE MANAGEMENT SYSTEM A user interface management system automates the generation of user interface. UIMS accepts specification of the presentation and dialog semantics to produce the presentation and dialog managers of the UI resp.managers of the UI resp. In the following we describe two UIMS. 1) Menulay 2) hypercard
  • 81. MENULAY Menulay is an early UIMS using the screen layout as the basis for the dialog model. The UI designer starts by designing the user screen.
  • 82. HYPERCARD This UIMS from appale incorporates object orientation in the event oriented approach. A card has an associated screen layout containing buttons and field.