SYSTEM PROGRAMMING
What is system programming?
System programming is the art of designing and implementing system programs. System
programming involves designing and writing computer programs that allow the computer
hardware to interface with the programmer and the user, leading to the effective execution of
application software on the computer system. It is the practice writing system software.
A system is defined as a collection of different components. Example are college, School, car
and equipment.
What is a programming? It designing and implementing the program.
Software is a collection of many programs.
Two types of software:
System software
Applications software.
1. System software
They are programs that assist the general use of application programs. Example are: operating
system and assembler.
2. Application software:
These are software developed for specific goals.
Therefore, system programs are programs which are required for the effective execution of
general user program on the computer system.
COMPONENTS OF SYSTEM SOFTWARE
Assembler
Compiler
Macro and Micro processor
Linkers
and Loaders
1
ASSEMBLER
These are the system programs which will automatically translates the assembly language
program into the machine language program. It makes it easy to make the programs
understandable to the microprocessor in the form of zeros and ones
COMPILER
These are system programs which will automatically translates the high level language program
to the machine language. The computer does not understand English and hence the need for a
compiler.
MACRO AND MICROPROCESSOR
Macro is a single line abbreviation for a group of instruction. Example
Macro Start of Definition
INCR Macro Name
A1, DATA
A2, DATA Sequence of instructions
A3, DATA to be abbreviated
….
….
AX, DATA
MEND End of Definition
Macro End
Below is a typical example of a macro program
A macro with two parameters
; Implements the write system call
%macro write_string 2 Start of Definition and Macro Name
mov eax, 4
mov ebx, 1
mov ecx, %1 Sequence of instructions
mov edx, %2
int 80h
2
%endmacro End of Definition
LINKING AND LINKER
Linking : the process of mnerging many object modules to form a single object program.
Linker: The software program which binds many object modules to make a single object
program
LOADER
It is a system program that place the object program to main memory and prepares it for
execution.
Function of a loader
Allocation
Linking
Relocation
And Loading
Types of Loader
- Compile and go Loader
- Relocatiing loader
- Direct Linking Loader
- Absolute Loader
- General Loader
- Dymanic Loader.
FUNCTION OF THE SYSTEM SOFTWARE
To achieve efficient performance of the system
To make effective execution of the general user program
To make effective utilization of the human resoursces i.e. input and output devices
To make available, new, better facilities.
3
WHAT IS AN OPERATING SYSTEM?
This is a software that manages computer hardware, software resources, and provides common
services for computer programs. It serves as interface between the end user and computer
hardware.
FUNCTION OF OPERATING SYSTEM
• Job sequencing, scheduling, traffic controlling application.
Control over system performance –
Monitors overall system health to help improve performance. records the response time between
service requests and system response to have a complete view of the system health. This can help
improve performance by providing important information needed to troubleshoot problems.
Operating system Keeps track of time and resources used by various tasks and users, this
information can be used to track resource usage for a particular user or group of user.
• Input/ output programming.
• Protecting itself from uses and protecting the user from other users:
The operating system uses password protection to protect user data and similar other techniques.
it also prevents unauthorized access to programs and user data.
• Storage / Memory Management
The operating system manages the Primary Memory or Main Memory. Main memory is made up
of a large array of bytes or words where each byte or word is assigned a certain address. Main
memory is a fast storage and it can be accessed directly by the CPU. For a program to be
executed, it should be first loaded in the main memory. An Operating System performs the
following activities for memory management:
4
It keeps tracks of primary memory, i.e., which bytes of memory are used by which user
program. The memory addresses that have already been allocated and the memory
addresses of the memory that has not yet been used. In multi programming, the OS decides
the order in which process are granted access to memory, and for how long. It Allocates the
memory to a process when the process requests it and deallocates the memory when the
process has terminated or is performing an I/O operation.
• Error handling:
Operating system constantly monitors the system to detect errors and avoid the malfunctioning
of computer system.
Coordination between other software and users
Operating systems also coordinate and assign interpreters, compilers, assemblers and other
software to the various users of the computer systems.
Processor Management
In a multi programming environment, the OS decides the order in which processes have access
to the processor, and how much processing time each process has. This function of OS is called
process scheduling. An Operating System performs the following activities for processor
management.
Keeps tracks of the status of processes. The program which perform this task is known as traffic
controller. Allocates the CPU that is processor to a process. De-allocates processor when a
process is no more required.
Device Management
An OS manages device communication via their respective drivers. It performs the following
activities for device management. Keeps tracks of all devices connected to system. designates a
program responsible for every device known as the Input / Output controller. Decides which
process gets access to a certain device and for how long. Allocates devices in an effective and
efficient way. Deallocates devices when they are no longer required.
5
File Management
A file system is organized into directories for efficient or easy navigation and usage. These
directories may contain other directories and other files. An Operating System carries out the
following file management activities. It keeps track of where information is stored, user access
settings and status of every file and more… These facilities are collectively known as the file
system.
6
FOUNDATION OF SYSTEM PROGRAMMING
Figure: Foundation of system programming
1. People: these are the main users operating the system using the application program.
They need to execute instructions using the sequence. They are the main users who are
operating the system.
2. Application program: Also called Application App. it is designed to perform a specific
function directly for the user.
3. Compiler: Computer program (or set of programs) that convert source code written in a
programming languages (i.e. source language) into another computer language or
computer understandable language.
4. Assembler: It is a program that takes basic computer instructions and converts them into
a pattern of bits that the computer’s processor can use to perform its basic operations. For
the microprocessor to understand and perform.
5. Microprocessor: An integrated circuit that contains all the function of a central processing
unit of a computer. A place where each and every instruction is executed.
6. Loaders: Part of an operating system that is responsible for loading programs and
libraries(libraries is a place where each and every function of programs are stored).
7
7. Text Editors: it is a computer program that lets a user enter, change, store and usually
prints text. It is used to type programs e.g. Note pad.
8. Debugging: Process of finding and reducing the number of bugs or defects in a computer
program. It is a process to clear errors in a computer program.
9. Searching and Searching:
a) Sorting: It is the storage of data in stored order which can be either ascending or
descending order.
b) Searching: A search algorithm that receives information stored within some data
structure or system.
10. I/O Program: Input/output is the communication between an information processing
activity. A computer uses memory mapped I/O accesses hardware by reading and writing
to specific locations. Responsible for communication between I/O devices.
11. File System: Methods and data structures that an operating system uses to keep track of
files on a disk or partition.
12. Scheduler: Scheduling is the method by which work specified by some means is assigned
to. A scheduler is what carries out the scheduling activity. It schedules a program so that
it can be performed and executed successfully.
13. Libraries: A library is a collectionof non-volatile resources used by computer programs,
often to develop software.
14. Memory Management: Process of controlling and coordinating computer memory.
Computer has two types of memory i.e. main memory and secondary memory. The main
memory stores currently running programs.
15. Device Management: The process of managing the implementation, operation and
maintenance of a physical or virtual device with the help of device driver program.
8
EVOLUTION OF THE COMPLEMENTS OF A PROGRAMMING SYSTEM
ASSEMBLER:
Initially, programs were written in machine level codes (interms of 0 and 1. Later, programmers
found it difficult to write the program in machine language and started to make use of mnemonic
which they would subsequently translate into machine language. Such a mnemonic machine
language is now called as assembly language. Programs known as assemblers were written to
automate the translation of assembly language to machine language. The input to an assembler is
called as source program and the output is a machine language translation (object program).
LOADER:
After the program is translated then the object program needs to be loaded on to the memory
which is accomplished by another system program called loader.
The work of a loader is twofold that are as follows:
1. Loader save the core (memory) as in the absence of loader the source program,
assembler and the object program needs to be present simultaneously on the core. But
with a loader the assembler loads the object program in the secondary memory and a
loader is placed in the core that loads the object program in the core and transfer
control to it.
2. Loader also save time when the program is to be executed a number of times as each
time the object program is placed from secondary memory to core. Hence saving the
translation time that is consumed at each time the program is executed.
3. It is also used for relocation in case of subroutine. Subroutines are set of instructions
that are to be used by other routine for a particular task.
Basically subroutines are of two types open subroutine (macro definition) and closed definition.
In case of open subroutine the whole code is inserted in the main program i.e. the flow of control
is continuous. But that is not the case with the closed subroutine i.e. the control is transferred to
the subroutine. The subroutines are first on to the core hence it may happen sometime that two
9
programs make use of the same subroutine. In that case it may happen that a program may
overlap the subroutine hence destroying it. This problem can be overcome by translating the
subroutine to an object that can be relocated if there is a overlap.
The process of relocation can be described as follows:
a. Allocation- allocates space in memory for the program
b. Linking- resolves symbolic references between object decks.
c. Relocation-adjust all address-dependent locations.
d. Loading-physically places the machine instruction and data into core.
The time taken for a user program to execute is called execution time.
The needed for translation is called assembly or compile time.
The time needed to load a program into core is called as the load time.
MACROS
In case of lengthy programs the repeated identical parts uses the macro processing facility of
operating system. Here the identical part of the program is abbreviated and this is treated as a
macro definition and saves definition. The macro processor substitutes the definition for all
occurrences of the abbreviation (macro call) in the program. Basically it is used in design of
operating systems where a number of macro calls are written.
COMPILER
A compiler is a program that accepts a program in high level language and produces an object
program where an interpreter is a program that executes a source program as if it were in
machine language. Basically the name of the language and the compiler are same i.e. C, C++,
FORTRAN.
LINKER
Linker or link editor is a program that takes one or more objects generated by a compiler and
combines them into a single executable program.
10
Computer programs typically comprise several parts or modules; all these parts/modules need
not be contained within a single object file, and in such case refer to each other by means of
symbols.
Typically, an object file can contain three kinds of symbols:
• Defined symbols, which allow it to be called by other modules,
• Undefined symbols, which call the other modules where these symbols are defined,
• Local symbols, used internally within the object file to facilitate relocation.
11
MACHINE STRUCTURE
The components of a general machine are as follows:
1. Instruction interpreter: A group of electronic circuits performs the intent of instruction of
fetched from memory.
2. Location counter: LC otherwise called as program counter PC or instruction counter IC, is a
hardware memory device which denotes the location of the current instruction being executed.
3. Instruction register: A copy of the content of the LC is stored in IR.
12
4. Working register: are the memory devices that serve as “scratch pad” for the instruction
interpreter.
5. General register: are used by programmers as storage locations and for special functions.
6. Memory address registers (MAR): contains the address of the memory location that is to
read from or stored into.
7. Memory buffer register (MBR): contain a copy of the content of the memory location whose
address is stored in MAR. The primary interface between the memory and the CPU is through
memory buffer register.
8. Memory controller: is a hardware device whose work is to transfer the content of the MBR to
the core memory location whose address is stored in MAR.
9. I/O channels: may be thought of as separate computers which interpret special instructions
for inputting and outputting information from the memory.
13