0% found this document useful (0 votes)
38 views20 pages

CO ECE UNIT 1 PartA

1. A digital computer takes input in the form of instructions or programs, processes the input by accessing memory elements, and produces an output. 2. There are different types of computers including personal computers, workstations, servers, mainframes, and supercomputers which vary in size, speed, and power requirements. 3. The key functional units of any digital computer are the input, output, memory, arithmetic logic, and control units. The control unit governs the other units by transmitting control signals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
38 views20 pages

CO ECE UNIT 1 PartA

1. A digital computer takes input in the form of instructions or programs, processes the input by accessing memory elements, and produces an output. 2. There are different types of computers including personal computers, workstations, servers, mainframes, and supercomputers which vary in size, speed, and power requirements. 3. The key functional units of any digital computer are the input, output, memory, arithmetic logic, and control units. The control unit governs the other units by transmitting control signals.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Unit-1 Part A

Digital computer
A digital computer is a fast electronic data processing device, which takes the
input in the form of instructions (often referred as programs), process it by referring its
various memory elements and finally produces the result.

Types of Computers:
1.Personal computer

2. Workstations

3. Servers

4. Mainframe

5. Super Computer

Major parameters which can differentiate these computers are their size, speed and
power consumption requirements.

1. Personal Computer: Personal computers belongs to the category of desktop


computers. They are majorly used in small scale institutions, banks and homes. It supports
various input devices such as keyboard, mouse and joystick using which, it f etches data
from memory units. It also supports various output devices such as monitors, speakers etc.
using which it provides data to the outside world.

2. Work Stations: Workstations are another form of computers specially designed


for technical and scientific applications. They possess features like high degree of visual
effects, exceptional designing capabilities and increased computational speed. Thus
because of their versatile behavior, they have the capability to satisfy all the engineering
requirements.

3. Servers: Server is another form of computer device which has been developed to
process requests made by clients and deliver data to other clients as needed. It is generally
referred to as database as it maintains large volumes of storage locations.

4. Mainframes: Mainframes are computer devices which are developed to handle


large scale needs of business sector. They possess high speed as well as other
computational capabilities to support numerous peripheral devices and workstations.
5. Super Computers: Super computers are computer devices developed to handle
large databases or to perform very high level of complex calculations. They can perform
billions of computations in seconds. They usually occupy a room and is operated by many
engineers. They are majorly used in advanced military, scientific applications, designing
dynamics of machines, animated graphics, supersonic aircrafts.
Functional Units of Digital Computer

Fig: Block Diagram of Computer


Functional units of a computer are fundamental parts that form a computer. Every
computer is made up of five independent functional units and they are:
1. Input unit 2. Output unit 3. Memory unit 4. Arithmetic and logic unit 5. Control unit.

1. Input Unit: Input units are those units that accept the data from the outside world
for processing it. The most commonly used input unit is a keyboard. It is a device through
which data is supplied to the computer. Few other input units include mouse, scanners,
microphones, track balls, joysticks etc. These input units get connected to the computer by
using an interface.

2. Output Unit: These are the devices through which data is supplied to the outside
world after processing. The basic output device is a monitor which displays text and
images. Few other output devices include speaker, printer. The speakers are the devices
through which sound is generated which can also act as an amplifier. Printer is a device
which is used for printing data i.e., text or images on papers.

3. Memory Unit: It is a unit which is responsible for storing large volumes of


computer data. Basically, whenever a program is under execution, the processor utilizes
memories to extract required data for execution of the given program. Every computer
maintains two types of memories i.e., a) the primary and b) the secondary memory.

a) Primary memories are extremely fast memories. An example of primary memories is


RAMs. This memory is composed of semiconductor elements capable of storing single bit
of information. These elements together store certain length of data called words. A small
scale memory stores about few thousands of words whereas a medium scale memory can
store about few millions of words.
An extremely fast memory which is provided to speed up processor is referred to as
cache memory.

A computer consists of a new set of memory referred to as main memory. These


type of memories are rather slow, but can store large volumes of data, i.e„ data extending
in Giga bytes.

b)Secondary memories are less expensive and at the same time provide large storage
capacity. Few examples of secondary memories are magnetic tapes, CDROMs, Pen drives
etc.

4. Arithmetic and Logic Unit: Arithmetic and logic unit is responsible for
performing many arithmetic related operations. When user supplies data for either
addition, subtraction, multiplication or division etc., the processor initiates the arithmetic
and logic unit for further manipulations. For example, if a user wants to perform
multiplication of two numbers, the processor initially fetches the required data, i.e.,
operands and initiates the arithmetic and logic unit. The unit, considers this data and
accordingly performs the required computation and returns the output

5. Control Unit: The control unit forms the major component of the entire computer
whose main function is to govern the activities of other functional devices. This is done
by transmitting the required control signals to various units. These control signals inhibit
the activities of these units and instruct them to perform their operations in the prescribed
timing. Hence not granting full independence to other functional units which may lead to
degradation of system's performance.

Operational Concepts of a Digital Computer


The instructions are responsible for carrying out any activity in a computer. When a task is
to be performed, its associated program and data operands are stored in the memory.
Later, each instruction is executed on the processor one-by-one in order to carryout a
specified set of operations.

Example: Consider addition of two numbers is required to be performed. Let the


operands used in this addition are stored at memory locations LOC 1 and LOC 2. Then,
the code for this addition operation will be,

LD LOC1 ,R0

LD LOC2, R1

ADD R0, R1

In the first instruction, the operand at memory location LOC 1 is loaded into processor
register R0. In the second instruction, the operand and memory location LOC2 is loaded
into processor register R1. In the third instruction, the operand in register R0 is added with
the operand in register R1 and the sum is stored in register R1.
The data transfer between memory and processor is carried out by sending the address of
the required memory location to the memory unit and issuing the relevant co ntrol signals.
When this is accomplished, data can be transferred to or from the memory.

Interconnection Structure of Processor and Main Memory:


Basically, the processor structure internally consists of many complex circuitry i.e., ALU,
control unit and registers.

These registers are further divided into general purpose registers and special purpose
registers. Special purpose registers, as the name implies, are indulged in performing
various special activities. These registers include MAR, MDR, PC, IR etc among which,
only MAR and MDR possess direct contact with the main memory. Apart from these
registers, only control unit can have its direct contact with the main memory.

Figure: Interconnection Structure of Processor and Main Memory


The components of the processor are:

Memory Unit: It is an essential unit of every computer which is responsible for storing all
the essential data.

Control Unit: It is a unit that issues various control signals which are essential in
controlling the activities of all other computer units.

Arithmetic and Logic Unit: It is a unit that is responsible for performing various
arithmetical and logical operations.

MAR: It is responsible for addressing various locations in the memory.

MDR: It is responsible for reading/writing data from/to the Memory.

PC: It stores the address of the next instruction to be executed.

IR: It stores the instruction which is under execution.


General Purpose Registers: These are the registers which are responsible for storing
frequently required data related to program execution temporarily.

Consider the execution of a given program through this circuitry. Initially, the
data which is input through a keyboard gets stored in the main memory and the program
counter points to the first instruction. The address of this instruction gets stored in MAR
and MDR extracts the required instruction and stores it in the IR. This entire process gets
initiated only after receiving the control signals from the control unit. If the instruction
(which is stored in the IR) contains certain arithmetical and logical operations, then ALU
gets initiated which fetches the required operators and operands while considering MAR
and MDR registers. After termination of execution of first instruction, the result is
transmitted to MDR, which places it (result) into the math memory and its address gets
placed into MAR. Now, the program counter points to next instruction and the same
process repeats until all the instructions of the program get executed. In some situations,
while the program is under execution, it is possible that the processor may get interrupted
by any input/output routines. In such situations, the processor initially checks the priority
of the interrupt. If it is of high priority, then the processor places the contents of PC, IR,
the general purpose registers, and few control information in the memory and switches to
respond to that interrupt routine. Once the interrupt task gets completed, the processor
acquires stored contents from the memory and continues with its process. These interrupt
mechanisms are supported by modem computers so as to improve the overall performance
of the system and also to utilize the processor optimally. In this way, all the circuitry
forming a processor interacts with each other in solving a given computation.

BUS STRUCTURES:
A computer is a collaboration of large number of functional units. In order to carry out
their processing successfully, these functional units have to interact with each other by
exchanging messages and other information. For this purpose, these units need certain
interface. Hence, a transmission medium which is a combination of two or more wires and
capable of driving data from one unit to other unit is used which is referred to as a bus.

The following figure shows a single--bus structure.

Fig: SINGLE BUS STRUCTURE


A bus carry data in the form of signals with one signal per wire to a given functional unit.
Apart from data, a bus also includes wires which allow address and certain control signals
to be transmitted. As there is parallel transmission of signals, a single word can be
transmitted in each attempt, at the same time increasing the speed of the system since,
there is one bus connecting various functional devices. In above mentioned case, only two
units at a time can use the bus.

However, there are many systems which came into existence supporting more than one
bus. In those systems, parallel transmission of data is possible as well as more than one
device can interact with each other. But as the number of buses increases, the ef fective
cost and the complexity of the architecture increases. The architecture no longer remains
simple in implementation and flexible as it as single bus architecture.

When entire system is considered, there are many units with varying speeds. For
example, the processor of the system is always of high speed when compared to slow
devices like input/output units etc.

Hence, the architecture selected should provide compatibility among such devices.
In order to compromise with the relative speeds of these units, several mechanisms are
implemented. One of such mechanisms include, the introduction of special registers
referred to as 'buffer registers'. These registers store the data temporarily till completion of
a task. For example, if a processor needs to print 300 bytes of data the p rocessor simply
extracts the required data from the memory, transmits it to the buffer registers (maintained
by a given printer) and switches to next task. The printer sequentially extracts the data
from these registers and prints them accordingly. Hence, the processor will no longer
remain idle till the completion of printing process and can easily execute other tasks. This
mechanism not only increases the speed of the system, but also improves the system
performance.

DATA TYPES
Different data types for computer are as follows:

(i)Decimal Number System:


The decimal number system employs base 10 system where ten different symbols
can be used that are 0, 1, 2, 3, 4,.5, 6, 7, 8, 9. A string in decimal number system is
distinguished from other number systems by enclosing it in parenthesis and inserting base
10 as its subscript. For example, (4562.95)10.

Example: The string (4562.95)10 is interpreted as;

4 x 10 3+5 x 10 2+6 x 10 1+2 x 10 0+9 x 10 -1+5 x 10 -2 = 4 x 1000+5 x100+6 x 10+2 x 1+9 x


0.1+5 x 0.01

=4000+500+60+2+0.9+0.05

= (4562.95)10

(ii) Binary Number System:


The binary number system employs base 2 system where only two different
symbols are use that are 0 and 1. A string in binary number system is distinguished f rom
other number systems by enclosing it in parenthesis and inserting base 2 as its subscript.
For example (110110)2.

Example: The string (110110)2 is interpreted as,

1 x2 5+1 x 2 4+0 x 2 3+1 x2 2+1 x2'+0x2° = 1 x 32 + 1 x 16 + 0 x 8 + 1 x 4 + 1 x 2 + 0 x 1

=32+16 +0+4 +2+0 = (54) 10


Therefore, (110110)2= (54)10, which means (110110)2 is a string in binary number system
and is equivalent to the string (54) 10 in decimal number system.

(iii) Octal Number System:


The octal number system employs base 8 system where eight different symbols are
used including 0,.1, 2, 3, 4, 5, 6 and 7. A string in octal number system is distinguished
from other number systems by enclosing it in parenthesis and inserting the base 8 as its
subscript. For example, (162.54)8. Example: The string (162.4)8 is interpreted as,

= 64+48+2+0.5 = 114 + 0.5 = (114.5) 10


Therefore, (162.4)8 = (114.5)10, which means that the string (162.4) 8, in octal
number system is equivalent to the string (114.5)10 in decimal number system.

(iv) Hexadecimal Number System:


The hexadecimal number system employs base 16 system where sixteen different
symbols can be used that are 0, 1, 2, 3, 4, 5, 6, 7. 8, 9, A, B. C, D, and F. The symbols A,
B. C, D, E and F correspond to 10, 11, 12, 13, 14 and 15 respectively in decimal numbe r
system. A string in a hexadecimal number system is distinguished from other number
systems by enclosing it in parenthesis and inserting the base l6 as its subscript. For
example (C2B)16

Example: The string (C2B)16 is interpreted as,

C x 16 2+ 2 x 16 1 + B x 16 0

= 12 x 256 + 2 x 16 + 11 x 1 = 3072 + 32 + 11 = (3115) 10


Therefore, (C2B)16 = (3115)10, which means the string (C2B) 16 in hexadecimal
number system is equal to the string (3115) 10 in decimal number system.

Some examples of Conversion from one form to other:


Binary to Octal Conversion: In this conversion the binary number is first partitioned into
groups of three binary digits, starting from the lower order bit. If the last group of higher
order hits is not complete, then zeroes are added as higher order bits to complete the
group. Each group is then assigned to its octal equivalent. Thus, each group corresponds
to binary-coded octal numbers. The first 14 binary-coded octal numbers are listed below.
Decimal Octal Binary coded Decimal Octal number Binary coded
Equivalent number octal number Equivalent octal number
0 0 000 10 12 001 010
1 1 001 11 13 001 011
2 2 010 12 14 001 100
3 3 011 13 15 001 101
4 4 100 14 16 001 110
5 5 101 15 17 001 111
6 6 110 16 20 010 000
7 7 111 17 21 010 001
8 10 001 000 18 22 010 010
9 11 001 001 19 23 010 011

Example: Converting the binary string (1100010) 2 into an octal number.


Step 1: Divide the given binary number into groups of three binary digits.

( 1, 100, 010)2

Step 2: Add 0's at high order bit positions to complete the last group.
( 001, 100, 010)2

Step 3: The octal number equivalent of each group is,

( 001, 100, 010)2

1 4 2 [ From the above table]

Thus, the octal number equivalent


of, (1100010)2 is (142)8.
Binary to Hexadecimal Conversion: In this conversion, the binary number is first
partitioned into groups of four binary digits, starting from lower order bit. If the last group
of higher order bits is not complete, then zeroes are added as higher order bits to complete
the group. Each group is then assigned to its hexadecimal equivalent. Thus, eac h group
corresponds to binary-coded hexadecimal numbers. The first twenty binary-coded
hexadecimal numbers are listed below.
Decimal Hexadecimal Binary coded Decimal Hexadecimal Binary coded
Equivalent number Hexadecimal Equivalent number Hexadecimal
number number
0 0 0000 10 A 1010
1 1 0001 11 B 1011
2 2 0010 12 C 1100
3 3 0011 13 D 1101
4 4 0100 14 E 1110
5 5 0101 15 F 1111
6 6 0110 16 10 0001 0000
7 7 0111 17 11 0001 0001
8 8 1000 18 12 0001 0010
9 9 1001 19 13 0001 0011

Example: Converting (1111010111000)2 into a hexadecimal number.

Step 1: Divide the given binary string into groups of four binary digits, starting from

lower-order bit. (1, 1110, 1011, 1000) 2

Step 2: Add 0's at higher order bit positions to complete the last

group. (0001, 1110, 1011, 1000) 2

Step 3: The hexadecimal equivalent of each group is

(0001, 1110, 1011, 1000) 2

1 E B 8 [From the above table]

Thus, the hexadecimal equivalent of (1111010111000) 2 is (1EB8)16.

EXERCISE: Convert the following number sytems.

1. (465.0647)8 to binary, decimal, hexadecimal equivalents.


2. (10A4.249)16 to binary, octal, decimal equivalents.

3. (10101100111.0101)2 to ( )10
4. (153.513)10 = ( )8
5. (292)10 = ( 1204) b determine ‘b’? Sol: Given that (292) 10 = ( 1204) b
292 = 1 x b 3 + 2xb 2 + 0xb 1 + 4xb 0 =
b 3 + 2b 2 + 4 b 3 + 2b 2 = 292 – 4=288
By trail and error method, b=6.
6 3+2(6 2) =288 Thus (292)10 = ( 1204) 6
6. Decimal system became popular because we have 10 fingers a rich person on earth
has decided to distribute Rs.1 lakh equally to the following persons from various
planets. Find out the amount each one of them will get in their respective
currencies:
A from planet VENUS possessing 8 fingers
B from planet MARS possessing 6 fingers C from
planet JUPITER possessing 14 fingers D from planet
MOON possessing 16 fingers.
Sol: a person on earth has 10 fingers i.e base is 10.
1 lakh= (100000)10
A from planet VENUS possessing 8 fingers = base 8 on venus
(100000)10 =(303240)8
B from planet MARS possessing 6 fingers = base 6 on Mars
(100000)10 =(2050544)6
C from planet JUPITER possessing 14 fingers = base 14 on Jupiter
(100000)10 =(2862C)14
D from planet MOON possessing 16 fingers.= base 16 on moon (100000)10
=(186A0)16

---------------------------------------------------------------------------------------------------
---------

Types of Complements:
There are two different types of complements for any system with
base 'r'. They are, (i) (r - 1)'s complement (ii) r's
complement.

(r - l)'s Complement: (r - 1)'s complement of a number N in base 'r’ and having n digits
is, (rn -1)-N

r’s Complement: The r’s complement of a number N in base ‘r’ and having n digits
is, (rn –N) The r’s complement of N can also be obtained by adding '1' to its (r - 1)'s
complement i.e.,

For Decimal Numbers (base = 10): The two types of complements for
decimal numbers are (i) 9's complement i.e., (r -1) ‘s complement (ii) 10's
complement i.e., r’s complement.

(i) 9's Complement: The 9's complement of a decimal number N is defined as,
(10 n-1)- N Where 10 n = 1 followed by ‘n’ 0s .
Therefore, 10 n - 1 = n number of 9's.

Example 10 5 = (100000)10 and 10 5— 1 = 100000 — 1 = (99999)10


Thus, 9’s complement of a decimal number N is obtained by subtracting each of its
digits from 9. The 9's complement of 25783 is 99999 — 25783 = 74216.

(ii) 10's Complement: The 10's complement of a decimal number N is defined as,
10 n — N Where, 10 n = 1 followed by n 0s .
In other words, the 10's complement of N can be obtained by keeping all least signif icant
zeroes unchanged, subtracting the first non-zero least significant digit f rom 10 and then
subtracting all the remaining higher significant digits from 9.

Example: The 10's complement of 25783 is obtained by subtracting the first non -zero
least significant digit, i.e., 3 from 10 and then subtracting the remaining higher order
digits i.e., 8, 7, 5 and .2- from 9.
Thus 10's complement of 25783 is 74217.
An alternative method of finding 10's complement of N is adding 1 to its 9's
complement. The 9's complement of 25783 is 74216. Thus, the 10's complement of 25783
is 74216 + 1 = 74217.

For Binary Numbers (Base 'r' = 2): The two types of complements for binary
numbers are, (i) l's complement i.e., (r -1)'s complement (ii) 2's complement
i.e., r's complement.

(i) 1’s Complement: The 1 's complement of a binary number N is defined as, 2 n-1-N

Where, 2 n = 1 followed by n number of


0's Therefore, 2n — 1 = n number of
ls.
Example,
2 5 = (100000)2 and 2 5 -1 = 100000 - 1 =(11111)2

In other words, 1's complement of a binary number N is obtained by subtracting each of


its digits from 1. This subtraction changes all 0s to 1s and all 1s to 0s. Thus, the l's
complement of a binary number N can be obtained by changing 1s to 0s and 0s to 1s.
Example The 1 's complement of (110110110)2, is (001001001)2.

(ii) 2’s Complement: The 2 's complement of a binary number N is defined as, 2 n-N

Where, 2 n = 1 followed by n number of 0's


In other words, 2's complement of a binary number N is obtained by keeping all its least
significant zeroes and the first ‘1' unchanged, and then changing all the remaining higher
order digits from 0s to 1 s and ls to 0s.
Example: The 2's complement of (110110110) 2 is obtained by keeping the lower order 0
and 1 unchanged and then changing the remaining bits from 0s to ls and ls to 0s. Thus, the
2's complement of 110110110 is 001001010.
An alternative method of finding 2's complement of N is by adding 1, to its l's
complement. Example: The l's complement of 110110110 is 001001001. Thus, the 2's
complement of 110110110 is 001001001 +1 which is 001001010.

Example: Find (72532 - 03250) using 9's complement.


Answer : (72532 -
03250)10
Let A=
72532 , B =
03250
Then A - B = A + (9's complement of B)
9's complement of B = 9's complement of ( 03250 )
= (1On — 1) —N = (1On — 1) —3250
=(100000-1) — 3250 = 99999 — 3250 = 96749
A + 9's complement of B = 72532 + 96749 = (1) 69281
(Carry)
Since, a carry is generated, it is added to the least significant bit of the result.
69281
+ 1
-------------
69282

Software
System Software: A system software is usually a program residing in main memory
which is capable of organizing various components of a computer. (or)

System software is a collection of various programs, providing a platform to the user


through which he can easily interact with the system. Examples of system software
include operating systems, text editors, compilers etc.
Functions of System Software: A system software is responsible for performing the
following functions:

• It facilitates execution of user developed programs by including various libraries


and packages etc.
• It controls various input and output activities.
• It accepts and processes various commands provided by user.
• It performs memory management functions.
• It manages all the application programs and accordingly stores and retrieves them.
• It converts high level language programs into machine level language (binary).

• It controls various programs such as video games, where there is strong user
intervention. It also executes user written application programs.
• It schedules various processes in accordance to their priorities.
• It organizes all the peripheral devices attached to a given system.
• It prevents system failures and unauthorized accessing of the system by providing
authorization codes such as user names and passwords etc.

Text Editor:
Text editor is a system software which provide feasibility to users while typing
data belonging to several application programs. These editors receive several commands
entered by the user and accordingly execute them. Several new editors provide f acilities
such as highlighting inappropriate sentences, changing colour of misspelled words,
underlining the sentences which are not obeying the syntax etc. Apart from these features,
the editors consider the data entered by the users into a file and accordingly store them
into memory or other locations. These editors sometimes display informative messages if
the user is not following the exact format. This can be observed in word processor editor.

Language Translator:
A language translator is a type of system software that translates a program written
in a second, third or higher-generation language into machine language. Language
translators are of three types. They are, (a) Assemblers (b) Compilers (c) Interpreters.

(a) Assembler: An assembler is a system utility program responsible for conv erting
assembly language instructions into machine language instruction. There exists one
machine language instruction for individual assembly language instruction because of the
presence of one-to-one mapping between assembly language and machine language.
Assemblers are not only able of converting the instruction but ate also capable of
generating error messages. Examples of assembler include 8085 assembler, 8086
assembler etc.

(b) Compiler: A compiler is a system utility program responsible for converting high-
level instructions into machine language instructions. All the instructions are converted at
a time. Compilers are capable of generating error messages encountered during
translation. After successful compilation of a program, compiler software is no t required
as the machine instruction can be reused several times. Examples of compilers are Pascal
compile; C compiler, COBOL compiler etc.

(c) Interpreter: Interpreter is similar to that of a compiler but the difference arises in
their conversion format. Interpreter interprets every individual instruction and executes it
immediately rather than executing entire program at once. In case of any error, the
program execution is halted until the error is rectified. The interpreter needs to be stored
in the memory till the program-execution is completed. Interpreter is useful while
debugging because it displays the error message soon after interpreting individual
instruction.

Loader:
Loader is a program which is responsible for performing the loading function i.e., it brings
executable file into a given memory location. The loader carries out four functions.

1. It loads machine as well as data instruction into its specified memory location.
2. It assigns load time storage memory area to the program.
3. It relocates the program so that it can be executed appropriately.
4. It links two separate object programs with each other.

There are two different types of loaders.

(a) Absolute Loader: Absolute loader loads the instruction at the exact location as
specified in the header. If the specified memory location is not available, then execution
of the program cannot be carried out further till the memory space gets free.

(b) Relocating Loader: In this loader, program is loaded into the memory location by
modifying the addresses of the memory location as needed in order to guarantee accurate
referencing. The responsibility of locating the file in the memory lies with the operating
system and not file's header. It works very efficiently, but it also has an overhead of
calculating relative offsets which causes a delay.

Linker:
A linker refers to a program or a software that takes one or more compiler objects
and combines them together to form a single executable program. This program is stored
on a disk with `.exe' extension. To run this program, the loader must firstly load all the
program's instructions into the primary memory and then direct the CPU to begin the
instruction execution starting from the first instruction onwards.

Fig: Linking
process Operating System:

Operating System: An operating system is a software or computer program that controls


the computer hardware. It acts as an interface or an intermediate between the user and
hardware. It provides platform for running application program.

Role of operating System:


(i) Operating system as a resource manager.

(ii) Operating system as a user/computer interface.


(i) Operating System as a Resource Manager: Operating system is an interface between
user and the hardware. A computer system consists of a set of resources, where in
data manipulations is done through these resources. Operating system can be viewed
as a resource allocator in this context. It allocates various resources like CPU time
memory space, file-storage space, input/output devices etc.
All these resources are under the control of the operating system. Thus operating system
acts as the resource manager or a resource allocator.

The primary task of an operating system is to keep track of who .is using which
resource, to grant resource request, to account for usage and to resolve conflicting requests
from different programs and users. In this way, operating system manages and protects
memory, input/output devices and other resources when different processes share them.

In the above figure, the main memory was occupied jointly by operating system as well as
the other programs i.e., the main memory (a resource) is being controlled by both of them.
Operating system controls the processor and I/O controllers to execute the programs and
to fetch data from 1/0 devices.
(ii) Operating System as a User/Computer Interface: The facilities (both hardware and
software) provided to the user can -be viewed in the following hierarchical manner.
As shown in the figure bellow, the users of the applications are not concerned with
the hardware details instead, a computer system can be viewed as a collection of
applications to the end users.
An application programmer is responsible for developing applications in some
programming language. Some of the system programs called as utilities or utility
programs are provided to the users which assists them in creating programs, managing
files and controlling I/O devices. Among the available system programs, OS is the most
important program which hides the hardware details from the programmers by providing a
suitable interface to them.

Functions of Operating System: The functions performed by operating system are as


follows,

1. Resource Management: operating system is also called as resource allocator. This


is because, it responsible for controlling and allocating various hardware resourc es (CPU,
printer, power etc), communication resources, CPU time, memory space, file -storage
space etc., to users. it also executes a user program efficiently.

2. Process management: An operating system is also responsible for managing


process execution. A multiprogramming operating system runs multiple processes
concurrently.

3. File Management: An operating system is also responsible for managing the f ile
name, directory name etc. It also provides access properties like file size, type, modified
etc.

4. Memory Management: Operating system also manages memory needed for


executing the user's program.

5. Communication management: operating system provides networking services


like Local Area Networking (LAN) and Wide Area. Networking (WAN) services.
6. Security Management: Operating system provides various security services to
protect the data from illegitimate software attacks. Antivirus soft wares are the most
commonly used security service installed on a computer to protect the data from getting
corrupted. Besides this, various password preserving mechanism as well as firewalls are
to avoid unauthorized.

Services provided by the OS


The services provided by the OS are as follows,

1.The OS helps the programmers during the process of program development by


providing various services such as editors, debuggers etc. Even though these services are
not the integral part of an OS, they are available to the programmers in the form of utility
programs and are referred to as 'application program development tools.

2. The OS performs certain scheduling tasks such as loading instructions and data
into the main memory, initializing the I/O devices and files and preparing other resources
etc. All these operations must be required for executing programs. The OS perf orms all
these tasks thereby reducing the burden of the programmers.

3. Each I/O device requires specific instructions or control signals for their operation
which makes the process of accessing I/O devices difficult. This difficulty can be
overcome by the OS by providing a uniform interface that can hide all these details f rom
the programmers, hence these devices can be accessed by performing simple read and
write operations.

4. The OS in a multi-user environment that controls the access to the files by


providing a protection mechanism. It not only provides a detailed understanding of the
nature of the I/O devices but also describes the structure of the data stored in the f iles on
the storage medium.

5. The OS (in shared/public system) is responsible for controlling the access to the
system or to some system resources thereby protecting the resources and data from
unauthorized users and resolving the conflicts that results from resource contention.

6. OS is capable for verifying certain internal and external hardware errors such as a
device failure or malfunction, a memory error etc., and other software errors such as
division by zero, inability of an OS to execute the request etc., during run time. All these
errors can cause serious affects, if they are not handled properly. Hence, OS clears all
these errors there by reducing their impact on the running applications.

7. A good OS can monitor certain performance parameters such as response time in


order to improve the overall performance of the system. It also maintains usage statistics
for many system resources.

Types of Operating Systems:


The different types of operating systems are as follows,

1. Single-user Operating System: This operating system allows a single user to


perform operation on the computer at a given instance of time. In this type of operating
system, a single application rather than multiple application can be executed at one time.

2. Multi-user Operating System: In contrast to single user operating system, this


operating system enable multiple users to operate the computer simultaneously. This
operating systems perform efficient utilization of CPU by assigning equal amount of time
slice to every individual user (connected through different terminals).

3. Multi-process Operating System: In this type of operating system, a single


program is processed by multiple CPUs. This operating system is used basically when
batch processing has to be supported. The multi-processing operating system is often used
because it acts as a backup 1hr the existing CPU.

4. Batch Processing System (1960s): A batch processing operating system reads a


set of separate jobs, each with its own control card. This control card contains information
about the task to be performed. Once the job is completed its output is printed. The
processing in a batch system does not involve interactions of user and the job during its
execution. However, in these systems the CPU was not utilized efficiently due to
mismatch in processing speed of mechanical card reader and electronic computer.

Example: MS-DOS

5. Multiprogramming (1970s): In mono-programming, memory contains only one


program at any point of time. Whereas in multiprogramming, memory contains more than
one user program.
In case of mono-programming, when CPU is executing the program and I/O
operation is encountered then the program goes to I/O devices, during that time CPU sits
idle. Thus, in monoprogramming CPU is not effectively used i.e., CPU utilization is poor.
However, in multiprogramming, when one user program contains I/O operations, CPU
switches to the next user program. Thus, CPU is made busy at all the times.

A single user cannot keep CPU busy at all times. Hence, multiprogramming
increases CPU utilization by organizing jobs (programs), so that CPU is busy at all times
by executing some user program or the other.

The idea in multiprogramming is as follows, The OS picks one of the jobs from job pool
and sends the jobs to CPU. When an I/O operation is encountered in that job, OS allocates
I/O devices for that jobs and allocate CPU to next job in the job pool. However, in mono -
programming, CPU sits idle while I/O operation is being performed. In multiprogramming
most of the time CPU is busy.

Advantages of multiprogramming are,


(i) CPU utilization is high (ii) Higher job throughput.

Throughput is the amount of work done in a given time interval.

Throughput =
Example: Windows

6. Time Sharing System (1970s): Time sharing is considered as multiprogramming


systems logical extension. In time sharing system, the user has a separate program in
memory. Each program in time sharing system is given a certain time slot i.e.; operating
system allocates CPU to any process for a given time period. This time period is known as
"time quantum" or time slice. In Unix OS, the time slice is 1 sec i.e., CPU is allocated to
every program for one sec.
Once the time quantum is completed, the CPU is taken away from the program and
it is given to the next waiting program in job post. Suppose, a program executes I/O
operation before 1 sec time quantum, then the program on its own releases CPU and
performs I/O operation. Thus, when the program starts executing, it executes only for the
time quantum period before it finishes or needs to perform I/O operation. Thus, in time
sharing any users shares the CPU simultaneously. The CPU switches rapidly from one
user to another giving an impression to each user that he has own CPU whereas, actua lly
only one CPU is shared among many users. CPU is distributed among all programs. In a
situation where there are more number of jobs that are ready to be inserted into me
memory when there is not enough memory a decision made to select the jobs among them.
This decision making is known as "Job scheduling".
Example: Unix

7. Real Time System (1980): Real time operating systems are time bounded systems,
wherein the system must respond to perform a specific task within predefined boundary.
There are two types of real time system.

(i) Hard Real Time System: In this real time system, actions must be perf ormed on
specified time which could otherwise lead to huge losses. It is widely used in factories and
production lines.

Example: In automobile, assembly line welding must be performed on time. This is


because a weld before or after the specific, instance can damage the product.

(ii) Soft Real Time System: In this real-time a specified deadline can be missed. This
is because the level of loss is low compared to hard real time system.

Example: A video game can has voice not synchronized to the movie. This is still
undesirable but does not causes huge loss.

8. Distributed System: It is a collection of independent, heterogeneous computer systems


which are physically separated but are connected together via a network to share resources
like files, data, devices, etc. The primary focus of distributed system is to provide
transparency while accessing the shared resource i.e., a user should not worry about the
location of the data. There are various advantages of distributed systems like they help in
increasing computation speed, functionality, data availability and reliability.

Example: Novell network.

Sharing of Processor Time between User Program & OS Sub routines:


An Operating System (OS) is a program which acts as an interface between a user and a
computer. It provides user friendly environment to the operator, so that the user can
directly interact with the system. The operating system performs functions such as,

❖ Input/output management. ❖ Memory or disk management. ❖ Organization of various


peripheral devices. ❖ Scheduling various processes allocation of priorities. ❖ Granting
access to various system resources. ❖ Inhibiting unauthorized users from accessing
different system resources etc.
In order to understand the services of an operating system, consider a simple
example. Assume that, certain data is provided as input to the system which gets stored in
the main memory, which is later extracted and executed and finally the result is displayed.
In all the activities mentioned, an operating system plays a vital role. While data is to be
provided to the system, operating system enables the keyboard operation through whic h a
user enters the required data (which is nothing but an application program). When
execution of this program begins, assume that this program requires certain f ile which is
currently residing on the disk. To manage this situation, the control switches f rom the
program to the operating system where OS extracts the corresponding file and stores it in
the main memory and later returns the control to the program. As soon as the execution of
program completes, it is again the responsibility of the operating system to gain the
control and display the results on output device. In this way an operating system and a
user program interacts with each other by sharing the processor. This can be
diagrammatically represented as shown below.

From bellow diagram the slots. In this way, the operating system routines
way different activities are handled and a user program share the processor.
by the operating system can be
captured. During the time period T0
and T1, the user program is loaded
into the main memory. During time
period T2 and T3, the required file is
extracted from the secondary storage
and loaded into the memory. After
the end of entire processing, the
results are passed on to the monitor
where they are displayed. In this
scenario, it is the processor who is
responsible for switching control Figure: Various activities handled by OS
between various components. It
schedules these operations by maintaining time
slots. Specified component gets activated only when the processor authorizes it to
use its time

You might also like