7. 1. Operating System
a) Definition of OS
b) Services and Functions of OS
c) Process Management , Process Synchronization
d) Memory management :- Paging and Segmentation
e) Disk Management
8. 2. Data Structure
a) How to define data structure?
b) Classification of data structure
c) Searching in DS
d) Sorting in DS
15. Introduction to System Software
Concept of System Software
● Definition of Software.
● There are two categories of software
○ Application Software
■ Develop using programming lang. And Tools
■ Application software interact with system software
■ Design to perform a group of coordinated functions , tasks, activities for benefits of users.
■ Eg. Word, Exel, browsers, Account management system.
○ System Software
■ System software provide platform to the application software.
■ Task such as editing, linking,translating, managing resource, I/O Devices and error handling.
■ It is a set of programs which are developed to operate, control & extend processing capabilities of computer itself.
■ Eg. Operating system, compiler, Assembler, Interpreter etc.
How does application software interact with OS?
16.
17.
18. • System Software is usually written using Low-level
language such as Assembly language. Some
essential functions of System software are:
– Disk Management
– Memory Management
– Device controlling
– Loading and execution of other programs.
19. Needs and Goals of system softwares
1. To run the hardware parts of computer and other
applications.
2. To provide platform to all the applications software’s.
3. Handles all the hardware , software and network together.
4. Converts all human instructions into machine
understandable formats.
5. Manage basic functions such as storing data, retrieving
files & scheduling task etc.
6. To make effective execution of each program.
7. To make effective utilization of human resources.
20. 1. System calls and System program.
A system call creates an interface between the user process and the services offered by the operating
system. So, the user process can directly communicate with the operating system and request the service it
requires.
While developing an application program or the system program the developer needs to embed these system
calls in the code. This helps the program in utilizing the services of the operating system. Each operating
system has its own set of system calls that decides what operations the operating system is able to perform.
21. Example of System Call
Let us say there is a user program that copies the content of one file to another file.
sequence of system calls are
1. Prompt a message on the screen for the user to provide the name of the source and destination files.
2. Read the name of the source and destination file character by character from the keyboard.
3. Open a source file. Open (and if not available Create) the destination file.
4. Read from the source file and write to the destination file.
5. Close the source and destination file.
6. Prompt a message that displays the successful execution of the program.
7. Terminate the user program.
22. ● System Program :- System programs are computer
programs that provide platform for application
programs to work.
● System Programming :- A System Programming
language is basically referred to a programming
language designed for writing system software , which
usually requires different development approaches
when compared with application software.
25. Need of Language Domain
● It helps in minimizing the errors caused by the
semantic gap.
● It helps in bridging the gap between the different
domain and find out if there are errors in the input
of any domain.
26. Language Processor
A language processor, or translator, is a computer program that translates source code from one
programming language to another. They also identify errors during translation.
Language Processor Activities
● Language processing activity bridges the ideas of software designers with actual execution on the computer system.
● The designer expresses the idea related to the application domain of the software.
● To implement these ideas, the description of the ideas has to be interpreted as related to the execution domain of the computer
system.
● Two categories:
● Program generation activity
● Program Execution activity
27. Program generation activity
● This activity generates a program from its specification program.
Program generation activity bridges the specification gap.
○ A program generator is a software system program that accepts the
specifications of the program to be generated and generates the program in
the target program in a target programming language.
○ This activity generates a program from its specification.
○ The program generator introduces a new domain between the application and
the programming language domain called the program generator domain.
○ It accepts the source program and generates a program in the target
language.
28. Program Execution activity
● This activity aims at bridging the execution gap by organizing the execution of a
program written in a programming language on a computer system. A program
may be executed through translation and interpretation.
○ This activity involves the actual execution of the program generated by the program
generator. The program execution activity bridges the implementation gap.
○ The program execution activity involves loading the program into the memory of the
computer system, interpreting the program instructions, and executing them on the
computer system.
○ During program execution, the computer system reads the program instructions from
memory and executes them one by one, performing the necessary computations and
producing the desired results.
○ The program execution activity involves various components of the computer system,
including the processor, memory, input/output devices, and other system resources
required to execute the program
29. Difference between Application and
system software
– What it is?
– Installation?
– Level of language?
– Use?
– Design requirements?
– Fixed for machine?
– Who uses it?
– Examples?
30. System Software Application Software
System software is a set of computer programs that is designed to
manage system resources.
Application Software is a type of software that is mainly developed
to perform a specific task as per the user's request.
It acts as an interface between the Application Software and
Computer hardware.
It acts as an interface between the end-user and System Software.
It is a general-purpose software. It is a specific-purpose software.
System software is usually installed on the computer system at the
time of OS installation.
Application Software is usually installed on the system as per the
requirement of the user.
This software runs independently and works as a platform for
working application software.
This software is not capable of running independently, which means
they need system software to work on.
These are usually written in low-level languages such as Assembly
language.
These are usually written in a high-level language such as C, C++,
Java, etc.
System software work on the background, hence user don't directly
interact with them.
Application software work on user-interface, hence user directly
interact with them.
A system software starts running as we turn on our computer system
and stops when the system is turned off.
Application software runs as per user request. It means when we
launch them, then only they start and stop when we close them.
The development of System software is complicated and takes more
time compared to application software, as they are built by
considering the hardware compatibility.
Development of Application software is comparatively easier and
takes less time than system software.
A computer system can't run without system software. A computer system can always run without application software.
However, for users, it is required to have some important
application software to work on.
The working of system software is automated and starts functioning
automatically after starting the computer system.
The working of application software is manual, which means the
user needs to start using it.
Examples of System Software are Operating systems, Compiler,
Assembler, Device drivers, etc.
Examples of Application Software are Web browsers, MS office,
Graphic design software, etc.
31. Introduction to various System
Programs
1. Assemblers :- Single, Two and Multipass Assembler
2. Loaders :- Four Functions
a. Allocation
b. Linking
c. Relocation(Changing certain instruction)
d. Loading
3. Linkers
4. Macro Processors
5. Compiler
6. Interpreters
7. Operating System
8. Device Drivers(abstraction layer between hardware and application or OS)
34. ● What is system software & application software?
● List and explain various types of System programming components.
● What is a language processor?
● Write a note on the evolution of system software.
● Define Loader. What are the different functions of loaders?
● Arrange the following System Softwares according to their role in Program
Execution: Linker, Loader, Compiler, Macro-preprocessor, Assembler, Text Editor.
● Enlist the functions of loader.
● List and explain activities performed by Language processor.
38. Assembler
Assembler is a program for converting instructions written in low-level assembly code into relocatable machine
code and generating along information for the loader.
The assembler performs a one-to-one mapping from mnemonic instructions to machine statement and data.
Mnemonic is a code usually 1 to 5 letters that represents an op-code followed by one or more numbers.
This is in contrast with high level language in which single statement generally results in many machine
instructions.
Assembly Language: Assembly language is a kind of low level programming language, which uses symbolic
codes mnemonics as instruction.
ADD,SUB,LTD and STA.
39. Some example of mnemonics are
Instruction Op code Assembly Mnemonic
00 STOP
01 ADD
02 SUB
03 MULT
04 MOVER
05 MOVEM
06 COMP
07 BC
08 DIV
09 READ
10 PRINT
40. Elements of Assembly Language
● Mnemonic operation codes
Instead of using numeric operation code (op code) , mnemonics are used.
Eliminates the need to memorize numeric operation codes.
Eg . ADD, SUB , MOVE etc.
● Symbolic operands
Symbolic names can be associated with data or instructions. Symbolic names can be
used as operands in assembly statements (need not know details of memory bindings).
Eg . ADD R1,R2,R3
● Data declarations
Data can be declared in a variety of notations, including the decimal notation (avoids
conversion of constants into their internal representation)
Eg. NUM1 03
or NUM 0011H
41. Assembly Language Statements
● Assembly language programs consist of three types of statements −
• Executable instructions or Imperative Statements
The executable instructions or simply instructions tell the processor what to do. Each instruction consists of
an operation code (opcode). Each executable instruction generates one machine language instruction.
Eg. ADD, SUB etc.
• Assembler directives
Statement this kind of neither represent the machine instruction to be included in the object program nor indicate the
allocation of storage for constant or program variable. They are use to indicate certain things regarding how assembly of
the input program is to be performed.
Eg. ABC START 1000
END
• Declaration Statements
These are non executable statements. They declare constants or storage areas or storage areas in a program.
Eg. X DS 2 DS – Declare storage. -🡪 indicate that a storage area namely X reserved for 2 word.
G DS 200 ---🡪 ?
42. Format of Assembly language Statement
● Assembly language statements are entered one statement per line. Each
statement follows the following format −
[label] ,mnemonic/opcode ,operand specification, [;comment]
● The fields in the square brackets are optional.
● A basic instruction has two parts, the first one is the name of the instruction (or the
mnemonic), which is to be executed. Eg. ADD , SUB, MOVE
● First operand is always register. Eg. R1, R2, R3
● Second operand is memory word using symbolic name.
● Eg. ADD R1 ONE/1
43. Literals and Symbol
Literals are the constant value enclosed in ‘ ‘ .
Example:-
MOVER AREG, =‘5’.
Symbols are the labels or variables.
Example:-
LOOP MOVER AREG,X
Symbol
Symbol
44. Literals and Symbol Data Structure
Literal Table
Symbol Table
INDEX NAME OF
LITERALS
ADDRESS
INDEX NAME OF
SYMBOLS
ADDRESS
45. Advanced Assembler Directives
ORIGIN(ORG)
• This can be used to indirectly assign values to symbols.
• When this statement is encountered during assembly of a program, the assembler reset its location counter to the
specified values.
• The ORG statement will thus affect the values of all labels defined until the next ORG.
Syntax :- ORIGIN <address spec>
Example :- ORIGIN 201 , ORIGIN LOOP+ 4 🡪(Expression)
46. Advanced Assembler Directives
LTORG
• LTORG allows placing literals into a pool at some other location in the object program.
• Directives LTORG creates a literal pool that contain all of the literal operands used since the previous LTORG or
the beginning of the program.
• The LTORG statement permit a programmer to specify where literals should be placed. By default, assembler
places the literals after the END statement.
EQU
• Most assemblers provide an assembler directive that allows the programmer to define symbols and assign the value
evaluate by the expression in the operand field.
Syntax
Symbol EQU Value/ symbol name
Example :- 1. A EQU 1 --🡪 1 value assign to A
2. X EQU Y 🡪 X is set to the address of Y.
3. X EQU LOOP 🡪 X is set to the address of LOOP.
47. Let’s take a look on how this program is working:
● START: This instruction starts the execution of
program from location 200 and label with START
provides name for the program.(JOHN is name
for program)
● MOVER: It moves the content of literal(=’3′) into
register operand R1.
● MOVEM: It moves the content of register into
memory operand(X).
● MOVER: It again moves the content of
literal(=’2′) into register operand R2 and its label
is specified as L1.
● LTORG: It assigns address to literals(current LC
value).
● DS(Data Storage): It assigns a data space of 1
to Symbol X.
● END: It finishes the program execution.
48. Basic function of Assembler:
● Translate mnemonics opcodes to machine language.
● Convert symbolic operands to their machine addresses.
● Build machine instructions in the proper format
● Convert data constants into machine representation.
● Error checking is provided.
● Changes can be quickly and easily incorporated with a reassembly.
● Variables are represented by symbolic names, not as memory locations.
● Assembly language statements are written one per line. A machine code
program thus consists of a sequence of assembly language statements,
where each statement contains a mnemonics.
49. Advantages:
● Reduced errors
● Faster translation times
● Changes could be made easier and faster.
● Addresses are symbolic, not absolute
● Easy to remember
Disadvantages:
● Assembler language are unique to specific types of computer
● Program is not portable to the computer.
● Many instructions are required to achieve small tasks
● Programmer required knowledge of the processor architecture and instruction set.
50. Translation phase of Assembler:
The six steps that should be followed by the designer
1. Specify the problem
2. Specify data structure
3. Define format of data structure
4. Specify algorithm
5. Look for modularity
6. Repeat 1 through 5 on modules
54. Pass 1 Purpose:- Define symbols and literals
● Determine length of machine instructions(MOTGET1)
● Keep track of Location Counter(LC)
● Remember values of symbols until pass 2(STSTO)
● Process some pseudo ops, e.g. EQU , DS(POTGET1)
● Remember literals(LITSTO)
56. Example 1 :- For the following program Show
Symbol and Literal Table
JOHN START 200
MOVER R1,=‘3’
MOVEM R1,X
L1 MOVER R2,=‘4’
X DS 1
END
57. 2.
START 1000
READ N
MOVER B, =’1’
MOVEM B, TERM
AGAIN MULT B, TERM
MOVER C, TERM
ADD C, =’2’
MOVEM C, TERM
COMP C, N
BC LE, AGAIN
MOVEM B RESULT
LTORG
PRINT RESULT
STOP
N DS 1
RESULT DS 3
TERM DS 1
END
START 1000
READ N 1000
MOVER B, =’1’ 1001
MOVEM B, TERM 1002
AGAIN MULT B, TERM 1003
MOVER C, TERM 1004
ADD C, =’2’ 1005
MOVEM C, TERM 1006
COMP C, N 1007
BC LE, AGAIN 1008
MOVEM B RESULT 1009
LTORG 1010,1011
PRINT RESULT 1012
STOP 1013
N DS 1 1014
RESULT DS 3 1015
59. START 1000
READ N
MOVER B, =’1’
MOVEM B, TERM
AGAIN MULT B, TERM
MOVER C, TERM
ADD C, =’2’
MOVEM C, TERM
COMP C, N
BC LE, AGAIN
MOVEM B RESULT
LTORG
PRINT RESULT
ADD C, =’6’
SUB C, X
STOP
N DS 1
RESULT DS 3
61. Phases Of Assembler
Analysis phase:
• Separate contents of the label, mnemonic opcode and operand fields of a statement.
• If a symbol is present in the label field, enter the pair (symbol, <LC>) in a new entry of
the symbol table.
• Check validity of the mnemonic opcode through a look-up in the Mnemonics table.
• Perform LC processing, i.e., update the address contained in the location counter by
considering the opcode and operands of the statement.
Synthesis phase:
• Read the machine opcode corresponding to the mnemonic from the Mnemonics table.
• Get an address of each memory operand from the Symbol table.
• Synthesize a machine instruction or the correct representation of a constant, as the case
may be.
63. Intermediate code (IC)
● If a compiler translates the source language to its target machine language without
having the option for generating intermediate code, then for each new machine, a full
native compiler is required.
● Intermediate code eliminates the need of a new full compiler for every unique
machine by keeping the analysis portion same for all the compilers.
● The second part of compiler, synthesis, is changed according to the target machine.
● It becomes easier to apply the source code modifications to improve code
performance by applying code optimization techniques on the intermediate code.
64. Data Structures used for Intermediate Code
Mnemonic Opcode Table (MOT)
Op code Assembly
Mnemonic
Type
00 STOP IS
01 ADD IS
02 SUB IS
03 MULT IS
04 MOVER IS
05 MOVEM IS
06 COMP IS
07 BC IS
08 DIV IS
09 READ IS
10 PRINT IS
Assembler Directives (AD) (POT)
Op code Assembly
Directives
Type
01 START AD
02 END AD
03 EQU AD
04 ORIGIN AD
05 LTORG AD Declaration Statements(DL)
Op code Assembly
Directives
Type
01 DS DL
02 DC DL
65. Variant I of IC
Single digit number is the code used for a register. This is the first operand.
Memory operand is the second operand and represent in the following format.
(operand class , code)
Where , operand class 🡪 C (constant) , S(symbol) , L(Literal)
Example (C,300) , (S, 01) , (L, 01)
Index from
ST and LT
67. Variant II for IC
• In variant II, operands are processed selectively.
• Constants and literals are processed. Symbols, condition codes and CPU
registers are not processed.
69. Gernerate the Intermediate code
for given program.
START 1000
READ N
MOVER B, =’1’
MOVEM B, TERM
AGAIN MULT B, TERM
MOVER C, TERM
ADD C, =’2’
MOVEM C, TERM
COMP C, N
BC LE, AGAIN
MOVEM B RESULT
LTORG
PRINT RESULT
ADD C, =’6’
SUB C, X
STOP
N DS 1
RESULT DS 3
70. PASS 1 OF TWO PASS
ASSEMBLER
(FLOW CHART)
USING
DROP
71. Pass 2 Purpose :- Object Code is Generated
After the symbol table is completed in PASS 1 it does the actual assembly by
translating the operations and so on. The purpose of PASS 2 is to generate
object code.
1. Look up value of symbols(STGET)
2. Generate instructions(MOTGET2)
3. Generate data(for DC,DS and literals)
4. Process pseudo ops(POTGET2)
5. Base table :- Indicate which registers are specified as base registers by USING
pseudo-op codes and what the specified contents of these registers are.
72. Generate Target Code
OP-CODE REG. MEMORY
For Imperative Statement (IS)
REG 🡪 Opcode for register
Memory 🡪 Address of
symbol or literal
78. Forward Reference Problem
• The assembler specifies the symbols should be declared anywhere in the program. There
may be chances of using a symbol before its declaration which gives rise to a forward
reference problem.
• The solution for forward references problem is having an assembler of two pass. The
assembler cannot know the address of the forward reference label until it reads the
definition of the label.
• In forward referencing, variable or label is referenced before it is declared. Different
problems can be solved using One Pass or Two Pass forward referencing.
79. Single Pass Assembler
● A single pass assembler scan the input file only once. During that single pass
the assembler handles both table definitions and assembly.
● It is generally faster than a two pass assembler.
● Single pass assembler construct symbol table, literal table and pseudo-op
table.
● The main problem encountered in one pass is that of a forward reference.
● The problem of forward reference is handled by single pass assembler is
back patching.
80. ● Back patching is a process in which the operand field of an instruction
containing a forward reference is left blank initially.
● The address of the forward reference symbol is put into this field when its
definition is encountered in the program.
● In order to perform back patching , single pass assembler requires an
additional data structure called Table of incomplete instruction(TII).
82. Forward Reference in One-Pass Assembler
1. Omit the operand address if the symbol has not yet been defined.
2. Enter this undefined symbol into SYMTAB and indicate that it is undefined.
3. Adds the address of this operand address to list of forward reference associated with the SYMTAB entry.
4. When the definition for the symbol is encountered, scans the reference list and insert the address.
5. At the end of the program , reports the error if there are still SYMTAB entries indicated undefined
symbols.