CO ECE UNIT 1 PartA
CO ECE UNIT 1 PartA
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.
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.
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.
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.
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.
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.
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.
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.
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:
=4000+500+60+2+0.9+0.05
= (4562.95)10
C x 16 2+ 2 x 16 1 + B x 16 0
( 1, 100, 010)2
Step 2: Add 0's at high order bit positions to complete the last group.
( 001, 100, 010)2
Step 1: Divide the given binary string into groups of four binary digits, starting from
Step 2: Add 0's at higher order bit positions to complete the last
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.
(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
(ii) 2’s Complement: The 2 's complement of a binary number N is defined as, 2 n-N
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)
• 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.
(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:
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.
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.
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.
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.
Example: MS-DOS
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.
Throughput =
Example: Windows
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.
(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.
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