System Programming
System Programming
The
primary distinguishing characteristic of systems programming when compared to application
programming is that application programming aims to produce software which provides services
to the user (e.g. word processor), whereas systems programming aims to produce software which
provides services to the computer hardware (e.g. disk defragmenter). It requires a greater degree
of hardware awareness.
A processor is the device that operates on this information. Or processor is a device that
performs a sequence of operations specified by instructions in memory. A program is a
sequence of instructions. Information is in the form of ones and zeros called bits.
A code is a set of rules for interpreting groups of bits, e.g. codes for representation of decimal
digits is BCD, for characters are ASCII etc. there are two types of processors: input/output
processor and CPU. Th I/P processors are concerned with transfer of data between memory
and peripheral devices such as disks, printers etc. The CPU is concerned with manipulation
of data stored in memory.
Most systems programming is done with assembly language, but C, C++ and C# are also
used.
System Software
The programs implemented in either software and (or) firmware that makes the
computer hardware usable.
The software makes it possible for the users to focus on an application or other
problem to be solved, without needing to know the details of how the machine
works internally.
Compiler
A compiler is a translator which converts high level language (source program) to low level
language (object program or machine program).
Source program
compiler
Error message
Fig. compiler
Compiler also finds out various errors encountered during compilation of program. Compiler
converts HLL into LLL using various phases. A character stream inputted by user goes
through various phases of compilation which at least will give target language.
Assembler
Assembler is a translator which translates assembly language program into an equivalent
machine language program of the computer.
Assembler
Fig. assembler
Computer will always take more time to run assembly language program than machine
language program. Because computer takes time to convert assembly language program to
machine language program by running assembler program. But assembler reduces the work
done by the programmer.
Macros
Macros are like function having actual and formal arguments as there in C. but rather macros
are used in assembly language not in HLL.
e.g. a macro named SUM having P and Q as its formal arguments is called Macro calling
statement i.e. SUM A, B where A and B are its actual arguments. A and B will be copied into
formal arguments P and Q respectively.
MACRO
SUM P,Q
MACRO
Macro translation for
LOAD Q
ADD P
STORE P
SUM A, B
LOAD B
SUM A, B
MEND
ADD A
STORE B
MEND
Editor
Editor Sometimes called text editor, a program that enables you to create and edit text files.
There are many different types of editors, but they all fall into two general categories:
Line editors: A primitive form of editor that requires you to specify a specific line of text
before you can make changes to it.
Screen-oriented editors: Also called full-screen editors, these editors enable you to
modify any text that appears on the display screen by moving the cursor to the desired location.
The distinction between editors and word processors is not clear-cut, but in general, word
processors provide many more formatting features. Nowadays, the term editor usually refers to
source code editors that include many special features for writing and editing source code.
Linker
A linker is a program that combines object modules to form an executable program. Software
often consists of multiple source programs or modules which should be contained before
execution. Each module of software is compiled separately to produce object programs. Linker
will combine all these object modules & give it to loader to load it in memory for execution.
Source
program 1
Source
program 2
Source
..
program n
Compiler
Compiler
Object
program 2
Object
program 1
.Compiler
Object
program n n
..
1n
Linker
Loader
Executable program
Symbol resolution
Program 1
Program 2
# include<stdio.h>
Extern void show();
.
.
Void main()
{
Show();
}
Void display()
{
.
}
# include<stdio.h>
Extern void display();
Void show()
{
display()
}
Loaders
Loader is a program which accepts the input as linked modules & loads them into main memory
for execution by the computer. Loader loads or copies program from secondary storage to main
memory for execution. There is no clear difference between tasks of linker and loader. Basically
there task overlap each other. As, the loader can perform both linking and loading.
Functions of loader
Loading schemes
1. Simple compilation without loader (Compile and go loading scheme)
Compiler
or
Assembler
Program
loaded
into
memory
for
execution.
Free space
if compilation is done & object program are directly loaded without a loader, than
a translator (compiler or assembler) program will also take of lot of space in
memory which will result in wastage of memory.
On using loader with computation, loader will replace the space taken by compiler or assembler.
But loaders will take less memory than compiler or assembler causing more free memory to be
available to user.
Types of Loaders
Absolute loader: It is primitive type of loader which does only the loading. It does not perform
linking & program reallocation. In absolute loading, the programmer has to give the address in
memory explicitly where programmer ants to store the program. It the main limitation of
absolute loader.
Relocatable Loader: A loader which performs relocation with loading. It is responsibility of
relocatable loader to load each function or subprogram at non-overlapping address & to give
each function an original load address.