2. Introduction: System Software, Application
Software, components of a programming
system: Assembler, Loader, Linker, Macros,
Compiler
2
3. Software
Software is basically classified into two
categories, System Software and Application
Software. Where System Software acts as an
interface between Application Software and
hardware of the computer. The Application
Software acts an interface between user and
System Software. We can distinguish System
Software and Application Software on account
of the purpose of their design.
3
4. • System software is general purpose software
which is used to operate computer hardware.
It provides platform to run application
software.
• Application software is specific purpose
software which is used by user for performing
specific task.
4
6. Differences
System Software Application Software
System software is used for operating
computer hardware.
Application software is used by user to
perform specific task.
System software are installed on the
computer when operating system is
installed.
Application software are installed
according to user’s requirements.
In general, the user does not interact with
system software because it works in the
background.
In general, the user interacts with
application software.
System software can run independently. It
provides platform for running application
software.
Application software can’t run
independently. They can’t run without the
presence of system software.
Some examples of system software are
compiler, assembler, debugger, driver, etc.
Some examples of application software
are word processor, web browser, media
player, etc.
6
7. System Software Application Software
System Software is written in a low-level
language, i.e. assembly language.
Application Software is written in a high-
level language like Java, C++, .net, VB, etc.
System Software starts running when the
system is turned on, and runs till the
system is shut down.
Application Software runs as and when
the user requests.
A system is unable to run without system
software.
Application software is even not required
to run the system; it is user specific.
System Software is general-purpose. Application Software is specific-purpose.
Ex. Operating system. Ex. Microsoft Office, Photoshop,
Animation Software, etc.
7
8. Conclusion:
• Both, the System Software and the Application
Software together make a system useful for
the end user. The System Software is
compulsory for the system to work. Similarly,
the Application Software are necessary for the
user to perform their specific task.
8
9. Components of System Programming
• Interpreter
• Assembler
• Compiler
• Macros and Microprocessors
• Formal systems
• Debugger
• Linkers
• Operating system
9
10. Assembler
An assembler is a program that converts assembly
language into machine code. It takes the basic
commands and operations from assembly code and
converts them into binary code that can be
recognized by a specific type of processor.
10
11. Source Code or Machine Code?
• The actual program which the runs in a CPU consists of
instructions in machine code ; patterns of 0's and 1's stored
in words of memory. In the end, whatever means is used to
achieve it, the machine code has to be placed in the right
addresses for the dispatch unit of the CPU to run the
instructions.
• Human programmers find it difficult to write program in
machine code; it is difficult to understand, difficult to read,
difficult to remember. Instead, they may write in assembly
language ; this will be represented as a list of ASCII
characters, forming the letters of words which are easier to
understand, easier to read, easier to remember; but they
correspond precisely to the instructions which the CPU
executes, and can be translated into such instructions.
11
12. Example
• So, for example, INC COUNTER (which means,
increase the value of the number stored in the
register which has been given the label COUNTER"
is easier to understand and remember than
00101010001100; even if this is written in Hex
(0A8C) it may be easier to write, but no easier to
understand. (A language like C is a little different; it
also is represented by a string of ASCII characters;
but each word or line usually does not correspond
to a single instruction, but to a whole series of
such instructions).
In order to be useful, assembly language has to be precise; there has to
be no doubt how to translate the words into instructions; in order to do
this, it is important to follow a set of rules for a particular language
precisely.
12
13. Loader
A loader is a major component of an operating system that ensures all
necessary programs and libraries are loaded, which is essential during the
startup phase of running a program.
It places the libraries and programs into the main memory in order to
prepare them for execution.
Loading involves reading the contents of the executable file that contains
the instructions of the program and then doing other preparatory tasks
that are required in order to prepare the executable for running, all of
which takes anywhere from a few seconds to minutes depending on the
size of the program that needs to run.
13
14. As the program that has to be
executed currently must reside in
the main memory of the computer.
It is the responsibility of the loader,
a program in an operating system,
to load the executable file/module
of a program, generated by the
linker, to the main memory for
execution. It allocates the memory
space to the executable module in
main memory.
There are three kinds of loading
approaches:
• Absolute loading
• Relocatable loading
• Dynamic run-time loading
14
15. The following are the responsibilities of a loader:
• Validate the program for memory requirements,
permissions, etc.
• Copy necessary files, such as the program image or
required libraries, from the disk into the memory
• Copy required command-line arguments into the stack
• Link the starting point of the program and link any
other required library
• Initialize the registers
• Jump to the program starting point in memory
15
16. Linker
The Assembler generates the object code of a source program and hands it over to the linker. The
linker takes this object code and generates the executable code for the program, and hand it over
to the Loader.
The high-level language, programs have some built-in libraries and header files. The source
program may contain some library functions whose definition are stored in the built-in libraries.
The linker links these function to the built-in libraries. In case the built-in libraries are not found it
informs to the compiler, and the compiler then generates the error.
Sometimes the large programs are divided into the subprograms which are called modules. Now
when these modules are compiled and assembled, the object modules of the source program are
generated. The linker has the responsibility of combining/linking all the object modules to
generate a single executable file of the source program. We have two types of linkers.
16
17. Linking Types
Static Linking –
It is performed during the compilation of source program. Linking is
performed before execution in static linking. It takes collection of
relocatable object file and command-line argument and generate fully
linked object file that can be loaded and run.
Static linker perform two major task:
• Symbol resolution – It associates each symbol reference with
exactly one symbol definition .Every symbol have predefined task.
• Relocation – It relocate code and data section and modify symbol
references to the relocated memory location.
The linker copy all library routines used in the program into executable image. As a result, it
require more memory space. As it does not require the presence of library on the system when
it is run . so, it is faster and more portable. No failure chance and less error chance.
17
18. Dynamic linking –
• Dynamic linking is performed during the run time. This linking is
accomplished by placing the name of a shareable library in the executable
image. There is more chances of error and failure chances. It require less
memory space as multiple program can share a single copy of the library.
• Here we can perform code sharing. it means we are using a same object a
number of times in the program. Instead of linking same object again and
again into the library, each module share information of a object with
other module having same object. The shared library needed in the linking
is stored in virtual memory to save RAM. In this linking we can also
relocate the code for the smooth running of code but all the code is not
relocatable. It fixes the address at run time.
18
19. Linker Vs Loader
BASIS LINKER LOADER
Basic It generates the executable
module of a source
program.
It loads the executable
module to the main
memory.
Input It takes as input, the object
code generated by an
assembler.
It takes executable module
generated by a linker.
Function It combines all the object
modules of a source code
to generate an executable
module.
It allocates the addresses to
an executable module in
main memory for
execution.
Type/Approach Linkage Editor, Dynamic
linker.
Absolute loading,
Relocatable loading and
Dynamic Run-time loading.
19
20. Macros
A macro (which stands for "macroinstruction")
is a programmable pattern which translates a
certain sequence of input into a preset
sequence of output.
Macros can be used to make tasks less repetitive
by representing a complicated sequence
of keystrokes, mouse movements, commands,
or other types of input.
20
21. Example
In computer programming, macros are a tool
that allows a developer to re-use code. For
instance, in the C programming language, this is
an example of a simple macro definition which
incorporates arguments:
21
#define square(x) ((x) * (x))
22. After being defined like this, our macro can be
used in the code body to find the square of a
number. When the code is preprocessed
before compilation, the macro will be expanded
each time it occurs. For instance, using our
macro like this:
22
int num = square(5);
is the same as writing:
int num = ((5) * (5));
23. Assembly - Macros
Writing a macro is another way of ensuring modular
programming in assembly language.
• A macro is a sequence of instructions, assigned
by a name and could be used anywhere in the
program.
• In NASM, macros are defined
with %macro and %endmacro directives.
• The macro begins with the %macro directive and
ends with the %endmacro directive.
23
24. Assembly language macro definitions can be predefined and
placed in a macro library, or can be included "in-line" with the
assembly language program.
24
26. Example
For example, a very common need for programs
is to write a string of characters in the screen.
For displaying a string of characters, you need
the following sequence of instructions −
26
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
27. 27
Meanings of the Code
Assembly code Machine code
MOV EAX, 10000h B8 00010000
(Move 10000h into EAX)
ADD EAX, 40000h 05 00040000
(Add 40000h to EAX)
SUB EAX, 20000h 2D 00020000
(SUB 20000h from EAX)
27
Operand in instruction
28. 28
Fetched MOV EAX, 10000h
28
…
ALU
MemoryRegister
EAX
EBX
address
00
…
MOV EAX, 10000h
SUB EAX, 20000h
data
PC
0000011B8 00010000
IR
B8
00
01
00
00
ADD EAX, 40000h
05
00
04
00
29. 29
Execute MOV EAX, 10000h
29
…
ALU
Register
EAX
EBX
data
PC
0000011B8 00010000
IR
00010000
00
…
MOV EAX, 10000h
SUB EAX, 20000h
B8
00
01
00
00
ADD EAX, 40000h
05
00
04
00
Memory
address
30. 30
Fetched ADD EAX, 40000h
30
…
ALU
Register
EAX
EBX
data
PC
000100005 00040000
IR
00010000
Memory
address
00
…
MOV EAX, 10000h
SUB EAX, 20000h
B8
00
01
00
00
ADD EAX, 40000h
05
00
04
00
31. 31
Execute ADD EAX, 40000h
31
…
ALU
Register
EAX
EBX
data
PC
000100005 00040000
IR
0001000000050000
Memory
address
00
…
MOV EAX, 10000h
SUB EAX, 20000h
B8
00
01
00
00
ADD EAX, 40000h
05
00
04
00
32. Compiler
A compiler is a special program that processes
statements written in a particular programming
language and turns them into machine language or
"code" that a computer's processor uses. Typically,
a programmer writes language statements in a
language such as Pascal or C one line at a time using
an editor. The file that is created contains what are
called the source statements. The programmer then
runs the appropriate language compiler, specifying
the name of the file that contains the source
statements.
32
34. Compiler is a program that translates source code into
object code. The compiler derives its name from the way
it works, looking at the entire piece of source code and
collecting and reorganizing the instructions. Thus, a
compiler differs from an interpreter, which analyzes and
executes each line of source code in succession, without
looking at the entire program. The advantage of
interpreters is that they can execute a program
immediately. Compilers require some time before an
executable program emerges. However, programs
produced by compilers runmuch faster than the same
programs executed by an interpreter.
34