Unit1 SP Notes 2021
Unit1 SP Notes 2021
Unit1 SP Notes 2021
What is System?
System is the collection of various components • Ex:- Computer is a system
Computer is a system because it consist of various components like memory,central processing
unit,keyboard,mouse,etc
What is Programming?
Art of designing and implementing the programs.Program has its input and output.By providing input,it
gives output.
What is Software ?
Software is collection of many programs .
• Two types of software – 1.System software 2.Application software
System S/w
Software
Application S/w
1. System software: These are programs which are required for the effective execution of general user
programs on computer system. OR
System software coordinates the activities and functions of hardware and software, and it controls the
operations of computer hardware.
2. Application software : These are the software developed for the specific goal.
Ex. Media Player, Adobe Reader,Word Processing S/w, media player, Data base S/w, Graphics S/w,
Spreadsheet S/w etc.
2. Loader:-
It is a system program that places program into memory and prepares them for execution.
4.Compiler:
It is a system program that translate the high level language program(Source) into another machine
language or object program(target) .
---Compiler takes an entire program
--Compiler transforms code written in a high-level programming language into the machine code, at once,
before program runs.
--Compiler displays all errors after compilation
Error Messages
4.Interpreter: An Interpreter coverts each high-level program statement, one by one, into the machine
code, during program run.
--Interpreter takes a single line of code.
--the Interpreter displays errors of each line one by one.
Ex. FORTRAN , COBOL, PL/I etc
5.Formal Systems:
It is an uninterpreted calculus.
It consists of Alphabet,Axioms(a set of words),Inference( A finite set of relation)
These are important in the design, implementation and study of programming Language.
They can be used to specify the syntax( form) and the semantics ( Meaning) of programming language.
Ex:- Set theory, Boolean Algebra, post systems, Backus Normal Form etc.
6.Text Editors - Editor is a computer program that allows a user to create and revise a document.
• A text editor is a program in which the primary elements being edited are character strings.
• A text editor is a type of program used for editing plain text files.
• With the help of text editor you can write your program(e.g. C Program or Java Program).
Example : Notepad.
8.Device Driver: A device driver is a computer program that controls a particular device that is connected
to your computer.
Typical devices are keyboards, printers, scanners, digital cameras and external storage devices. Each of
these need a driver in order to work properly.
For example: for printer installation on your system you need to have printer driver.
9.Debugger : Debugging tool helps programmer for testing and debugging programs.
10.Operating System-An operating system is concerned with the allocation of resources and services,
such as memory, processors, devices, and information. The os correspondingly includes program to
manage these resources, such as a traffic controller, a scheduler, memory management module , I/O
programs and a file system.
Ex: DOS,Unix,Linux etc.
1. The goal of the Operating System is to maximize the work and minimize the effort of the user.
2. Most of the systems are designed to be operated by single user, however in some systems multiple users
can share resources, memory. In these cases Operating System is designed to handle available resources
among multiple users and CPU efficiently.
3. Operating System must be designed by taking both usability and efficient resource utilization into view.
5. Operating System gives an effect to the user as if the processor is dealing only with the current task, but
in background processor is dealing with several processes.
System View
1. From the system point of view Operating System is a program involved with the hardware.
2. Operating System is allocator, which allocate memory, resources among various processes. It controls
the sharing of resources among programs.
4. It is a program that runs all the time in the system in the form of Kernel.
Other Concepts:
It would be efficient of subroutine could be translated into an object form that the loader could
relocate directly behind this use’s program.
The task of adjusting programs so they may be placed in arbitrary core location is called relocations.
5 SEMESTER IV NOTES OF UNIT-I DEPT OF CSE , Dr.VIJAYA P BALPANDE
Multiprocessing
Means having more than are processor operating on the some memory simultaneously.
These are concerned with manipulation of data stored in memory.
Impure Procedures
i. Procedures that modify themselves.
ii. It is poor programming practice.
iii. Impure Procedures are not readily usable.
iv. They are not suitable for multiprocessing.
Pure Procedures:-
i. Do not modify itself
ii. To ensure that the instruction are the same each time a program uses .
iii. It is a good programming practice.They are easily reusable. pure procedures (re-entrant code) .
Multiprogramming allows multiple program to reside in separate areas of core at the same time. Program
to reside in separate areas of core at the same time.
MFT---Programs were give a fixed portion of core(Multiprogramming with Fixed Tasks (MFT))
MVT-- Programs were give varying size portion of core (Multiprogramming with Variable Tasks
(MVT)).
Fragmentation: Often in such partitioned memory system some portion could not be used since it was
too small to contain a program. The problem of “holes”or unused portions of core is called fragmentation.
For Example: Memory size- 1000kb program size= 800kb unused portion or hole= 200kb
If there are 5 holes of 200kb memory= 5* 200= 1000kb of memory can be made available by relocatble
partition method by combinnging it together.
Fragmentation has been minimized by the technique of relocatable partitions. Relocatable partitioned
core allows the unused portions to be condensed into one continuous part of core.
Simple Paging:In simple paging all the pages of a program must be in core for execution.
Demand Paging:In demand paging a program can be executed without all pages being in core, i.e., pages.
Q-Difference Between
machine code; when all the syntax every line is checked for syntax error
4. Machine code can be saved and used; Machine code cannot be saved;
source code and compiler no longer needed. interpreter is always required for
translation.
5. Since source code is not required, Source code can be easily modified
tampering with the source code is not and hence no security of programs.
possible
6. Debugging is slower. Debugging is Faster
2. If some open subroutine where called four Close subroutine perform transfer of
times. It would appear in four different control and transfer of data
placed in the calling program
4. Less time taken to process the jobs. More Time taken to process the jobs.
1. A pure procedure does not modify itself. Procedures that modify themselves are
called impure procedures.
3. Pure procedures are readily reusable. Impute procedures are not readily
reusable.
4. To ensure that the instructions are the Each processor executing an impure
same each time a program is used. procedure modifies its contents.
The CPU consists of an instruction interpreter, a location counter, an instruction register and various
working register and general register.
The primary interface between the Memory and CPU is via the memory address register and the memory
buffer register.
2. Location Counter(LC):The Location Counter(LC), also called Program Counter (PC) or instruction
counter(IC) is a hardware memory device which denotes the location of the current instruction begins
executed.
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. The 360
machine has 16 general-purpose registers consisting of 32 bits each.
6. Memory address registers (MAR): contains the address of the memory location
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.
Ans:-Assembly Language
There are four main advantages to using assembly rather than machine language.
1. It is mnemonic; e.g, we write ST instead of the bit configuration 01010000 for the store instruction
2. Address are symbolic, not absolute
3. Reading is easier
4. Introduction of data to program is easier
A disadvantage of assembly language is that it requires the use of an assembler to translate a source
program into object code.
The formats for machine instructions describe how registers and explicit or implied storage addresses
can be used to specify operands to and instruction.
In general, the second operand is moved, added, loaded etc., into the first operand. This means that the
transfer of data is from the second operand to the first.
Q-What are the instruction formats of IBM 360/370 machine?explain with an example.
Ans:-The formats for machine instructions describe how registers and explicit or implied storage
addresses can be used to specify operands to and instruction.
The RR format is an instruction in which both operands are registers coded in RR format.
11 SEMESTER IV NOTES OF UNIT-I DEPT OF CSE , Dr.VIJAYA P BALPANDE
The machine code format for RR instruction is:
Op R1 R2
0 7 8 11 12 15
Op R1,R2
AR 1,11
2. RX Format
Register index format instructions have their first operand in a register and their second in storage. The
latter is addressed by base, displacement, and index.
Op R1 X2 B2 D2
0 7 8 11 12 15 16 19 20 31
A R1,D2(X2,B2)
The second operand could use base, index, and displacement components to explicitly define a location.
Example:
The instruction:
A 8,4(9,10)
or
A R8,4(R9,R10)
If the base, index, and displacement is specified explicitly, these will be used in the machine code
translation.
If a symbol is used for specifying an address, then the assembler will generate a base and displacement
from the information it has been given in the USING instruction and the index will be zero unless
explicitly specified.
RS Format
The RS format uses three operands; the second operand is in storage and uses base and displacement
addressing.
Op R1 R3 B2 D2
0 7 8 11 12 15 16 19 20 31
The LM - Load Multiple instruction is an example of this format. This loads a number of a registers
with the contents of the same number of consecutive fields at a specified location. The first and third
operands are used together to indicate which registers are to be loaded.
Examples:
Assembler Machine Code
LM R3,R7,24,(R10) 9837A018
LM R3,R7,NUM 9837C04E
LM R3,R7,NUM+4 9837C052
SS Format
There are multiple types of SS - storage-storage format instructions; with one format, the two fields have
the same length; with the other, the lengths are different.
Op L1 B1 D1 B2 D2
0 7 8 15 16 19 20 31 32 35 36 47
Op D1(L,B1),D2(B2)
SI Format
The Storage Immediate format instruction uses a single byte coded within the instruction itself to hold the
data for the second operand.
Op I2 B1 D1
0 7 8 11 16 19 20 31
The assembler format is:
Op D1(B1),I2
Op Symbol , I2
Examples:
Assembler Machine code
MVI NUM,27 921BC04E
Ans:-A pseudo-op is an assembly language instruction that instruct assembler to perform particular task.
START is a pseudo-op that tell the assembler where the beginning of the program is and allows the
user to give a name to the program.
END is a pseudo-op that tells the assembler that the last card of the program has been reached.
USING is a pseudo-op that indicates to the assembler which general register to use as a base and
what its contents will be. This is necessary because no special registers are set aside for addressing,
thus the programmer must inform the assembler which register(s) to use and how to use them. Since
addresses are relative, he can indicate to the assembler the address contained in the base register.
The assembler is thus able to produce the machine code with the correct base register and offset.
Pseudo -ops(e.g, START and USING) do not generate machine code.
DC and DS :-The Define Constant (DC) and Define Storage (DS) instructions are pseudo-ops that
instruct the assembler to place a 10, a 4, and a 49 in 3 consecutive full words("F") in memory and
leave 10 more for DATA1.
A number before the F would cause multiple allocation, e.g DATA DS 100F causes the assembler
to set aside a 100 full word area.
Example:- DATA DC F ’10,4,49’
Example:- DATA1 DS 10F
LTORG- The pseudo op LTORG can tell the assembler to place the encountered literals at an
earlier location. Literal is defined as =F'10.
The arguments =F'10,=F'49,=F'4' are literals which will result in the creation of a data area
containing 10,49,4 and replacement of the literal operand with the address of the data it describes.
The assembler will construct a "literal table" at the end of the program.
This will contain all the constants that have been requested through the use of literals.
execution and the fact that the offset. Which is 12 bits long, can only specify a number from 0 to 4,095.
Thus it may be difficult to “reach” the data. That is, without using an index register and without changing
the contents of the base register, the core location we wish to address cannot be any further than 4,095
locations away from the core location to which the base register is pointing.