0% found this document useful (0 votes)
235 views

Unit-I SSOS Notes

System software consists of programs that support computer operation, including assemblers, compilers, loaders, linkers, and operating systems. Assemblers translate assembly language into machine code. Compilers translate high-level languages like C++ and Pascal into machine code. Loaders and linkers prepare programs for execution by relocating and combining object files. Operating systems control all computer processes. System software is dependent on machine architecture for features like instruction formats, but some aspects like linking are machine independent.

Uploaded by

MANI KANDAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views

Unit-I SSOS Notes

System software consists of programs that support computer operation, including assemblers, compilers, loaders, linkers, and operating systems. Assemblers translate assembly language into machine code. Compilers translate high-level languages like C++ and Pascal into machine code. Loaders and linkers prepare programs for execution by relocating and combining object files. Operating systems control all computer processes. System software is dependent on machine architecture for features like instruction formats, but some aspects like linking are machine independent.

Uploaded by

MANI KANDAN
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 61

System Software

• System software consists of a variety of


programs that support the operation of a
computer.
• Ex:
• Assembler,Loader and Linker, Macro
processor,Compilers and Operating System.
Compiler
• Programs are written in a high level language like
C++,Pascal etc.
• These programs are translated into machine
language using compiler.
• Assembler
• Some programs are written in assembly language
using macro instructions.
• The assembler contain macro processor that
translate the assembly language programs into
machine level language.
Loader and Linker
• The translated programs were prepared for execution
by the loader or linker.
• Debugger
• The program have been tested using the debugger.
• Operating System
• All the processes are controlled by operating system of
the computer.
• Ex: Unix or DOS : Commands are typed through
keyboard.
• Macos or Windows :Menus are used.It is selected using
mouse.
System Software and Machine
Architecture
• Machine dependent Feature
• The System software and Application software
concepts are differs in machine dependency.
• The application program is concerned with
solution of a problem not the machine.
• System software are not concern with
application but they are related to machine
architecture.
Example
• Assembler translate mnemonic instructions
into machine code.The addressing modes and
instruction formats in assembler are differ in
every machine.
• In Compilers hardware characterstics are
different.
Machine Independent Feature
• In some aspects the system software do not
depend on computing system.
• Example
• Logic of an assembler is same on most
computers.
• Code optimization techniques used by
compilers are independent of the target
machine.
Example
• The Process of linking in assembly subprograms
also not depend on computer system.
• Most of the system software is machine
dependent.
• SIC (Simplified Instructional Computer) is
designed to include the hardware features most
often found on real machines while avoiding
irrelavant complexities.
Loaders and Linkers
• A loader is a system program that performs
the loading function.It perform following
three processes.
1. Loading
2. Relocation
3. Linking
1.Loading
• It brings the object program into memory for execution.
• 2.Relocation
• It modifies the object program.So that it can be loaded at
an address different from the location originally specified.
• 3. Linking
• It combines two or more object programs and allows
references between them.
• Many loaders perform loading , relocation and linking
process.
• Some loaders perform only loading and relocation
operation. Linker only perform linking operation.
Basic Loader Functions
• There are two types in Loader
1. Absolute Loader
2. Bootstrap Loader
1.Design of an absolute Loader
• Absolute loader does not perform linking and
program relocation. It perform only loading
operation.
Algorithm
Design of an absolute Loader

• The above algorithm all the functions in single


pass.
• In this first header record is checked to verify that
the correct program has been presented for
loading.
• At each text record is read, the object code is
moved to the indicated address in memory.
• When the end record is reached , the loader
jumps to the specified address to begin execution
of loaded program.
Example
Example-Contd
Absolute Loader
• In Object program each byte of code is given
using hexadecimal value.
• For example operation code STL is represent by
pair of characters “1” and “4”.It occupy two bytes
of memory.
• When it is loaded into memory for execution .It
stored in single byte 14.
• This method is inefficient for both space and
execution time. So most machines store object
programs in binary form.
Simple Boostrap loader
• When computer is turned on special type of
loader called boostrap loader is executed.
• The boostrap loader loads the operating
system.
• The boostrap loader begin at address 0 in
memory of the machine.It loads the operating
system starting at address 80.
• Each byte of code is represented in hexa
decimal digits.
• After all the object code from device F1 has
been loaded, the boostrap jumps to address
80, and execute the loaded program.
Simple Boostrap loader
• The subroutine GETC read one charcter from
device F1 and convert ASCII to hexadecimal value.
• ASCII 0 is converted to numeric value 0.
• ASCII character 0-9 is converted numeric value 0-
9.
• A-F converted to numeric value 10-15.
• It is accomplished by subtract 48 from character
0-9. 55 from A to F.
• The main loop of boostrap keeps the address of
next memory location.
Example
Machine Dependent Loader Features
• Machine dependent loader feature include
1. Relocation
2. Program Linking
3. Algorithm and Data Structure for Linking
Loader
(i) Relocation
• Loaders that allow for program relocation are
called relocating loaders or relative loaders.
• There are two methods used for relocation
1. Using Modification Record
2. Using Relocation bit
Using Modification Record
• A modification record is used to describe each
part of the object code that must be changed
when the program is relocated.
• Each modification record specifies the starting
address and length of the field whose value is
to be altered.
• Each modification add the symbol COPY
starting address of the program.
Algorithm
Begin
get PROGADDR from operating system
while not end of input do
begin
read next record
while record type <> ‘E’ do
Begin
read next input record
while record type=‘T’ then
begin
Move object record from record to
location addr+ specified addr
Algorithm -Contd
While record type =‘M’
add PROGADDR at the PROGADDR + specified
address
End
End
End
Disadvantage of Modification record
• Modification record scheme is not suited all
machine architecture.
• It increase the size of program.
Relocation Using Relocation bit
• In this method there is no modification
record.In this relocation bit is added to each
word of object code.
– A relocation bit associated with each word of
object code.
– The relocation bits are gathered together into a bit
mask following the length indicator in each Text
record.
• If bit=1, the corresponding word of object
code is relocated.
• If bit=0 then no modification is necessary.
Example
Algorithm
Begin
get PROGADDR from operating system
while not end of input do
begin
read next record
while record type <> ‘E’ do
while record type <> ‘T’ do
begin
get length= second data
mask bits(M) as third data
Algorithm
For(i=0;i<length;i++)
if Mi=1 then
add PROGADDR at the location
PROGADDR+ Specified address
else
move object code from record to location
PROGADDR+ specified address
read next record
end
end
end
Example
• In the above example In line 1 FFC is mask bit.
• Equivalent binary value is 111111111100.
• In this first 10 words of object code need
relocation and last two words no need of
relocation.
Program Linking
PROGA
4040 LIST A

4054 END A
LIST B

END B
4112 LIST C

END C
REF1
REF1
REF2
REF3
Example-Contd
REF6
REF7
REF8
• The above example contain ProgA,ProgB and
ProgC.
• It contain ListA,ListB,ListC and each list end
with endA,endB and endC.
• Program contain references REF1 to REF8.
• For example ref4 is linked in following way.
Example-Contd
• Ref4 EndA-ListA+ListC
• 4054-4040+4112
= 41126
Algorithm and Data Structures for a
Linking Loader
Data Structure
• The main data structure needed for linking
loader is external symbol table.
• It store name and address of each external
symbols in control section.
• It contain two variables
• PROGADDR:It is beginning address in memory
where the linked program is to be loaded.
• CSADDR –Starting address of control section.
Algorithm
• There are two passes in linking loader
• Pass-I and Pass-II
• Pass-I
• In Pass-I all external symbols are stored in
ESTAB with address.
Algorithm for Pass 1 of a linking
loader:
Begin
get PROOADDR from operating system
set CSADDR to PROOADDR {for first control section}
while not end of input do
begin
read next input record {Header record for control section}
set CSLTH to control section length
search ESTAB for control section name
if found then
set error flag {duplicate external symbol}
else
enter control section name into ESTAB with value CSADDR
while record type ~ 'E' do
begin
read next input record
if record type = 'D' then
for each symbol in the record do
begin
search ESTAB for symbol name
if found then
set error flag (duplicate external symbol)
else
enter symbol into ESTAB with value(CSADDR + indicated address)
end {for}
end {while ~ 'E'}
add CSLTH to CSADDR {starting address for next control section}
end {while not EOF}
end {Pass 1}
Pass-II
• Pass-II of loader performs the actual loading
,relocation and linking of the program.
• In this when each text record is read , the
object code is moved to specified address.
• When a modification record is found then it is
verified in ESTAB.Then relocation is
performed.
• In last step loader transfer of control to the
loaded program to begin execution.
Algorithm
Begin
set CSADDR to PROOADDR
set EXECADDR to PROOADDR
while not end of input do
begin
read next input record {Header record}
set CSLTH to control section length
while record type != 'E' do
begin
read next input record
if record type = 'T' then -~
begin
{if object code is in character form, convert
into internal representation}
move object code from record to location
(CSADDR + specified address)
end {if 'T'}
else if record type = 'M' then
begin
search ESTAB for modifying symbol name
if found then
add or subtract symbol value at location
(CSADDR + specified address)
Else
set error flag (undefined external symbol )
end {if 'M' }
end {while != 'E'}
if an address is specified {in End record} then
set EXECADDR to (CSADDR + specified address)
add CSLTH to CSADDR
end {while not EOF}
jump to location given by EXECADDR {to start execution of
loadedprogram)
end {Pass 2}
Machine Independent Loader Features
• Machine independent loader feature include
1. Automatic Library search
2. Loader options
Automatic Library search
• The subroutines called by the program being
loaded are automatically fetched from the
library linked with the main program and
loaded.
• This feature is referred as a automatic library
call or library search.
• Linking loaders that support automatic library
search must keep track of external symbols
that are refered.
• For example SQRT function automatically
included via the library search function.
Automatic Library search
• The libraries contain assembled or compiled
versions of the subroutines.
• The library contain special structure that
contains a directory that gives the name of
subroutine and its address.
• When subroutine is called search the directory
and move to the corresponding address .
• Then object code of subroutine is loaded.
• In some operating system commonly used
libraries are permanently stored in memory.
Loader Options
• Many loaders have a special command language
that is used to specify options.
• (i) INCLUDE
• Syntax
• INCLUDE prog-name(library name)
• Direct the loader to read the designated object
program from a library.
• DELETE
• Syntax
• DELETE csect-name;
• Delete the external symbols or entire control
sections.
Loader Options
• CHANGE
• Syntax
• CHANGE name1,name2
• External symbol name1 to be changed name2;
• Example
• Include read(utlib)
• Include write(utlib)
• Delete rerec,wrrec
• Change rdrec,read
• Change wrrec,write
Example
• In the above example include control sections Read
and Write from the library UTLIB.
• It also delete the control sections RDREC and WRREC
from the load.
• Then Change the Symbol RDREC to Read and WRREC to
Write.

• LIBRAARY
• Most loaders allow the user to specify alternative
libraries to be searched.
• Ex:
• Library Mylib
• Statistical analysis performed the following conditions
• NOCALL, STDDEV,PLOT,CORREL
Loader Design Options
• Loader Design options include
1. Linkage Editors
2. Dynamic Linking
3. Bootstrap Loaders
Linkage editor
• Linkage editors perform linking prior to load
time.
• The below diagram shows the difference
between linkage loader and linkage editor
Linkage loader
• Linkage loader executed in following way
1. The source program is assembled or
compiled to produce an object program.
2. A linkage loader performs all linking and
relocation operations including automatic
library search if specified.
3. Load the linked program directly into
memory for execution.
Linkage Editor
• Linkage editor executed in following way
1. The source program is assembled or compiled to
produce an object program.
2. Linkage editor perform linking and produce a linked
version of program called load module or executable
image.
3. When user ready to run linked program, simple
relocating loader can be used to load the program
into memory.
4. In linkage editor program is executed in many times
without being reassembled. So linkage editor reduce
the overhead.
Example
Include planner(proglib)
Delete project
Include project(newlib)
Replace planner(proglib)
• Program planner uses large number of subroutines.
One of the subroutine is project.
• If subroutine project is changed then linkage editor
delete the old version of project and add the new
version of project into linked version of project.
• It is not necessary to go back original version of
program.
Dynamic Linking
• Linkage editor perform linking operation before the
program is loaded for execution.
• In dynamic linking subroutine is loaded and linked to the
program when it is first called.It is also called dynamic
loading or load on call.
• In dynamic linking several executing programs share one
copy of subroutine or library.
• In C dynamic link library is linked.
• Dynamic linking provides the ability to load the routines
only when they are needed. It save the time and memory.
• Dynamic linking avoids the necessity of loading the entire
library for each execution. Only necessary subroutine only
loaded.
Example of Dynamic Linking
[a] : Dynamic loader is part of operating
system.It is called from user program.
[b] : The OS examines internal tables to
determine whether or not routine is already
loaded.If necessary then routine is loaded
from system library.
Example of Dynamic Linking
[c] : Control is transferred from OS to the routine
being called.
[d]:When the subroutine completes its processing ,
it return to the OS then OS returns the control to
the program that issued the request.
[e]: After the subroutine is completed the memory
allocated was released and used for other
purpose.The subroutine is in memory as long as
memory is needed for other processing.
Delayed Binding
• Association of an actual address with the
symbolic name of the called routine is not
made until call statement is executed. This is
known as delayed binding.It provide flexibility.
Bootstrap Loaders
• Absolute loader program load the programs into memory.
• Absolute loader program is stored in ROM.
• Some computer program is directly executed from
rom.Some computer it is copied from ROM to main
memory and executed there.
• Another way is bootstrap loader.It read fixed length of
record from device.
• After read operation is complete control is transferred to
memory where instruction stored.
• If loading process requires more instructions then it read
first record and then first record read second and so on.
• The first record is refered as bootstrap loader.

You might also like