Computer fundamentals chapter 1
Computer fundamentals chapter 1
Even though the size, shape, performance, reliability, and cost of computers have been changing over
the last
seven!! years, the basic logical structure (based on the stored program concept), as proposed by Von Neumann,
has not changed. No matter what shape and size of computer we are talking about, all computer systems
perform
the following five basic functions for converting raw input data into useful information and presenting it to
a user:
1. Inputting. It is the process of entering data and instructions into a computer system.
2. Storing. It is the process of saving data and instructions to make them readily available for initial
or
additional processing as and when required. ·
3. Processing.' Performing arithmetic operations (add, subtract, multiply, divide, etc.), or logical operations
(comparisons like equal to, less than, greater than, etc.) on data to convert them into useful information is
known as processing.
4. Outputting. It is the process of producing useful information or results for a user, such as printed report
or visual display.
5. Controlling. Directing the manner and sequence in which the above operations are performed is known
as controlling.
The goal of this chapter is to familiarize you with the units of a computer system that perform these functions.
It
provides an overview of computer systems as computer system architects view them.
Int mal architectu re ·of computers differs from one system model to another. However, basic organizat
ion remains
the\ame for all computer systems. Figure 2.1 shows a block diagram of basic computer organizat
ion. In this
-- -- -- --- - - - - -- --- --- Input Unit 19
Storage unit
Secondary
Progra m and data Input storage
unit Output
Primary unit
rnformation (Resul ts)
storage
I
·1
-+ Indicates flow of
..J instructions and data
Arithmetic
Logic Unit ......... Indicates the control
exercised by the
control unit
Central Processing Unit (CPU)
INPUT UNIT
Data and instructions must enter a computer system befor
e the computer can perform any computation on the
supplied data. The input unit that links a computer with
its external environment performs this task. Data and
instructions enter a computer through an input unit in
a form that depends upon the input device used. For
example, data can be entered using a keyboard in a mann
er similar to typing and this differs from the way in
which data is entered through a scanner, another type of
input device. However, a computer's memory is designed
to accept ~H fl ·n~ code and hence , all input devic
es must transform input signals to binary c~
called i~ erfaceJ accomplish this transformation. Input il_!terfa~ s match
charac~ t cleviees-w-the-reqnirements of a comp the unique physical or electrical
uter system-:-- ~
In short, an input unit performs following functions:
OUTPUT UNIT
An output unit performs the reverse operation of that of
an input unit. It supplies information obtained from data
processing to outside world . Hence, it links a computer
with its external environment. As computers work with
binary code, results produced are also in binary fonn. There
fore, before supplying the results to outside world , the
[ ~w:=J ~ hae_ter 2: ~asic Computer Q_~ganiz
ation __
_ __ __ ,
•
system must convert them to hum an readable) form . Units called output
interfaces ~ccomp
task. Output inte rfaces match the a~ceptable _( 1 or electrical characteristics of output devices (terlis~ this
. ters unique phy sic~ mmals,
pnn , etc.) to the reqm.rements o f an e xter11a l environ ment.
STORAGE UNIT
Data and instructions entered into a
com put er system through input unit
before actual processi ng ~~ rts. Sim s hav e to be stored_ inside the compute
ilarly, results produced by a com put r
somewhere inside the computer system er _after pro ces smg hav e to be kept
bef ore being passed on to an output
preserve intermediate results for ong urut. Mo reo ver , a com put er must also
oing processing. Storage unit of a com
It provides space for storing data and put er sys tem cate rs to all these need
instructions, intermediate results, and s.
results for output.
In short, a storage unit holds (stores):
(CPU)
Control unit (CU) and arithmetic logi
c unit (ALU) of a computer system are
Processing Unit (CPU). It is the brain of together known as the Central
a computer system. In a human body, tile·
and other parts of the body function as brain takes all major decisions
directed by the brain. Similarly, in a com
all major calculations and comparison puter system, the CPU performs
s, and also activates and controls the
computer system. operations of other units of the
------------------------------------
THE SYSTEM CO NC EP T
· d · - bl 1 1 ,.,.
... n we integr
dep en d s on ot I1er u111ts a n 1s rea 1,za · c on y w 1
Poin ts to Ren1ember
o utput res ults of proces s ing. T wo types of storag e are
1. All compu ter syste ms perfor m 1hc _follow ing _f"ivc - primary and seco nd ary storag e. As co mpare d to
basic functio ns for co nvertin eo raw . 1npul data .mto
. primar y storag e. second a ry storag e is s lower in
useful informa lion - inpuui ng. sr-o nng. proces s ing. operat ion, large r in capac ity, cheap er in price, and
o utputti ng, and contro ll ing. ca n retain inform ation eve n when compu ter system
sw itc hes off or resets.
2. Figure 2. l shows rhe main compo ne nts of a co mpute r
system_ 8. During data proces s ing, actua l e xecuti on of
instruc tions takes place in the Arithmetic Logic Unit
3. Input w,ir enable s feedin g of data and instruc tio ns to (ALU) of a compu ter system .
a compu ter system from outsid e wo rld in compu ter
accept able fonn. 9. Control Unit (CU) of a compu ter sys tem manages
and coordi nates the o peratio ns of all other
4. Input interfaces transfo rm input data a nd in structi ons compo nents of the compu ter system .
(fed to a compu ter throug h its input device s) into
binary codes that are accept able to the compu ter. 10. Contro l unit and arithm etic log ic unit of a compu ter
system togeth er form the Centra l Proce ssing Unit
5. Outpu t unit enable s a compu ter sys tem to supply
(CPU) , which serves as the brain of the compu ter
inform ation (obtain ed from data proces sing) to
system and is respon sible for contro lling the
outsid e world in human accept able (reada ble) form.
operat ions of all other units of the system .
6. Outpu t ime,fa ces transfo rm inform ation (obtai ned
11 . We often refer to a compu ter as a compu ter system
from data proces sing) from binary fo,m to human
becau se it consis ts of integr ated compo nents (input
accept able (reada ble) forn1 .
unit, outpu t unit, storag e unit, and CPU) that work
7. Storage unit of a compu ter system holds data and togeth er to perfor m the steps called for in a progra m.
instruc tions to be proces sed and interm ediate and
Que stio ns
1. What are the five basic functi ons perfor med by a 5. Differ entiate betwe en the charac teristi cs of primary
compu ter system ? and secon dary storag e of a compu ter system .
2. Draw a block diagra m to illustr ate basic 6. What are the two m a in compo nents of CPU of a
organi zation of a compu ter system and explai n the compu ter system ? List the ma in functi ons of each
functi ons of variou s units. compo nent.
3. What is an input interfa ce? Ho w it differs from an 7. Write the logica l ~reps taken by a comp uter system
outpu t ~nterf ace? along with the roles of its main units in each step
while transf ormin g input data to useful inform ation
4. How many types of storaf, e a compu ter system for presen tation to a user.
norma lly uses? Justify the need for each storag e
type. 8. What is a system ? Why do we often refer to a
compu ter as a comp uter sys tem?
J
~ -~ - - - --=C~HAPTER 3
Number Systems
I •
CM ; I
flu tr
it+ IN C
NON-POSITIONAL NUMBER
SYSTEMS
Number systems are of two types
- non-positional and positional. In
When counting beyond ten fing early days, human beings counted
ers, they used stones, pebbles, on fingers.
counting uses an additive approa or sticks to indicate values. This
ch or non-positional number system method of
for 1, II for 2, III for 3, IIII for 4, . In this system, we have symbols suc,h
IlII l for 5, etc. Each symbol represe as l
in a number , and to find the val nts the same value regardless of its
ue of a number, one has to count position
Since it is very difficult to per the number of symbols present in
form arithmetic with such a num the num ber .
ber system , positional number sys
developed. tems were
24 Charter J · "lluml,er s, •Lt m
Observe that !he same digit signifies different values, depending on the position it occupies in the number. For
example,
Hence, we can represent any number by using the available digits and arranging them in various positions.
The principles that apply to decimal number system, also apply to any other positional number system. It is
important to keep track of only the base of the number system in which we are working.
The value of the base in all positional number systems suggests the following characteristics:
1. The value of the base detenrune~ the total number of different symbols or digits available in the number
system. The first of these choices is always zero.
2. The maximum value of a single digit is always equal to one less than the value of the base.
Ve describe below some positional number systems used in computer design and by computer professionals.
As an ilJustration, let us consider decimal number system that we use in our day-to-day life. In this system, base is
equal to 10 because there are altogether ten symbols or digits (0, 1, 2, 3, 4, 5, 6, 7, 8, and 9). You know that in
~ecimal number system, successive positions to the left of the decimal point represent units, tens, hundreds,
thousands, etc. Each position represents a specific power of the base (10). For example; decimal number 2586
(written as 2586 10) consists of digit 6 in unit position, 8 in tens position, 5 in hundreds position, and 2 in thousands
position, and its value can be written as:
Observe that the same digit signifies different values, depending on the position it occupies in the number. For
example,
Hence, we can represent any number by using the available digits and arranging them in various positions.
The principles that apply to decimal number system, also apply to any other positional number system. It is
important to keep track of only the base of the number system in which we are working.
The value of the base in all positional number systems suggests the following characteristics:
1. The value of the base determines the total number of different symbols or digits available in the number
system. The first of these choices is always zero.
2. The maximum value of a single digit is always equal to one less than the value of the base.
We describe below some positional number systems used in computer design and by computer professionals.
position, and proceeding in thi s way , we have 4's (i2) positi on, S's (2.1) position , l6 's (i4) position , and so on.
Therefore. decimal equivalent of binary number 10101 (w ritlen as 10101 ) is:
2
In order to be specific about which system we are referring to, it is a common practice to indicate the base as a
subscript. Hence, we write:
1010'2=2 1,o
Bir is the short fom1 of "binary digit". Hence, a "bit" in computer termjnology means ei ther a 0 or 1. An n-bit
number is a binary number consisting of 'n' bits. Figure 3.1 lists all 3-bit numbers along with their decimal
equivalent. Remember that we have only two digits, 0 and 1, in binary number system and hence, binary
equivalent of decimal number 2 has to be stated as 10 (read as one, zero). Another important point to note is that
with 3 bits (positions), only 8 (2.1) different patterns of Os and ls are possible, and it may be seen from Figure 3.1
that a 3-bit number can have one of the 8 values in the range Oto 7. In fact , any decimal number in the range Oto
2" -1 can be represented in binary form as an n-bit number.
Every computer stores numbers, letters, and other special characters Binary Decimal
in binary form. Computer professionals need to know raw data equivalent
contents of a computer' s memory on several occasions. A commonly 000 0
used way of doing trus is to print/display raw memory contents, 001 1
which is called ~mo,y dump . Memory dumps in binary form would 010 2
have many pages of Os and ls. Working with memory dumps in 011 3
binary form would be very difficult and error prone for computer 100 4
101 5
professionals. Hence, computer professionals often use octal and
110 6
hexadecimal number systems, as shortcut notations for binary. They
111 7
are described below.
Figure 3.1. 3-bit numbers with their
decimal values.
Octal Number System
In octal number system, the base is 8. Hence, there are only eight symbols or digits: 0, 1, 2, 3, 4, 5, 6, and 7 (8 and
9 do not exist in this system). The largest single digit is 7 (one less than the base 8). Each position in an octal
number represents a power of the base (8). Therefore, decimal equivalent of octal number 2057 (written as 2057s)
1s:
Observe that since there are only 8 digits in octal number system, 3 bits (2 3 = 8) are sufficient to represent any
octal number in binary (see Figure 3.1).
digit is For 15 (one less than the base 16). Each position in hexadecimal number system represents a power of the
base (16). Therefore, decimal equ ivalent of hexadecimal number I AP (written as lAP16) is:
He nce, I AF 16 = 4 31 10
4
Observe that since there are only 16 digits m hexadecimal number system, 4 bits (2 = 16) are s ufficient to
represent any hexadecimal number in binary.
Step 1: Determine the column (positional) value of each digit (this depends on the position of the digit and the
base of the number system).
Step 2: Multiply the obtained column values (in Step 1) by the digits in the corresponding columns.
Step 3: Sum up the products calculated in Step 2. The total is the equivalent value in decimal.
Example 3.1.
.- .
l1001i=?10
Solution: Solution:
Step 1: Determine column values Step 1: Determine column values
Column Number Column Value Column Number Column Value
(from right) (from right)
1 2°= l l 8°= l
2 2 1 =2 2 8 1= 8
3 2 2 =4 3
2
8 = 64
4 23 = 8 4 3
8 = 512
5 2 4 = 16
Step 2: Multiply column values by the Step 2: Multiply column values by the
corresponding column di gits corres ponding co lumn digits
16 8 4 2 51 2 64 8
xl xl x0 x0 xl x4 x7 x0 x6
16 8 0 0 2048 448 0 6
-\,.·. . . . , .. ,. ........
Example 3.3. Exiiiiipl~ 3:4. · ... ·, ': ,. ·, ,..
lAC16 = ?_10 . :.. ~- Ao;2;.=·?~~ ._..
...... , 1 • , ·- ~~--. • :- •. • •
. - . 4
..
Solution: Solution:
2 1 40527= 4 X73 + 0 X ?2 + 5 X7' + 2 X7°
lAC 16 = I X 16 +AX 16 + C X 16°
= l x 256 + 10 x 16 + 12 x 1 = 4 x 343 + 0 x 49 + 5 x 7 + 2 x I
= 256 + 160 + 12 = 1372 + 0 + 35 + 2
= 42810 = 140910
Solution: Solution:
4 3 2 1
1100}4 = I X 4 + 1 X4 + 0 X 4 + lAC13 = 1 X 13 2 +AX 13 + C X13°
0x4 1 + 1 x4° =Ix 169 + IO x 13 + 12 x 1
= 1 x 256+ 1 x64 + 0 x 16+ = 311 10
0x4+lxl
= 256 + 64 + 0 + 0 + I Compare the result with the result
= 321 10 obtained in Example 3.3.
Step 1: Divide the decimal number by the value of the new base.
Step 2 : Record the remainder from Step 1 as the rightmost digit (least significant digit) of the new base
number.
Step 3: Divide the quotient of the previous division by the new base.
Step 4: Record the remainder from Step 3 as the next digit (to the left) of the new base number.
Repeat Steps 3 and 4 , recording remainders from right to left, until the quotient becomes zero in Step 3. Note that
the last remainder, thus obtained, will be the most significant digit of the new base number.
Example 3.8.
2510 = ?2
Solution:
Steps 1 and 2: 25/2 = 12 and remainder 1
Steps 3 and 4: 12/2 = 6 and remainder 0
Steps 3 and 4: 6/2 = 3 and remainder 0
Steps 3 and 4: 3/2 = 1 and remainder 1
Steps 3 and 4: 1/2 = 0 and remainder 1
21 0 119 0
10 14 7
5 0 6
2 0
26 12 = C 20 0
10= A
4 0
0 I=1
0 4
Hence, 42810 = IAC16
Compare the result with the result Hence, 10010 = 400s
obtained in Example 3.3.
L _30 J C hapte r 3 : Numb er Sys1c1ns
,
Exam ple 3.13. Hxample J. /4.
100,o = ?4 I 7 15 w • 'l 12
S olutio n: So/11.tloll:
Rcma indcn, in
4 100 Re ma inders J2 17 15 ln.1sc 12
__
,_ 25 o 142 JI = 8
6 lI IO= A
2 0 ll =B
0
He nce, 171 5,o = BAB ,2
He nce, 100 10 = J 2 104
Compare the result with the
result o bta ined in Exam ple
3. 12.
Ba se Oth er T han 1o
Con ver ting f rom a Bas e Oth er Tha n 1O to Ano ther
othe r than JO, to a numb er in a nothe r base o ther than 10:
W e use the follo wing steps to conve rt a number in a base
Step 1: Conv ert the origin al numb er to a base IO (decimal) numb er.
base number.
Step 2 : Conv ert the decim al number obta ined in Step 1 to the new
Step 1: Convert fro m base 6 to base 10 Ste p 1: Conv ert JO 11102 to base I 0
4
1
545 = 5 X 6 2 + 4 X 6 + 5 X 60 10 l 1102 = I X25 + 0 X 2 + 1 X 2 ~ +
2 1
X 2 + 1 X 2 + 0 X 2°
= 5 X 36 + 4 X 6 + 5 X J ]
= 180 + 24 + 5 = 32 + 0 + 8 + 4 + 2 + 0
= 209 w = 4610
(Co11ti nued on 11ext page ... ) (Conti nued on n ext page ... )
----- --
Example 3.16 illustrates the method of converting a binary number to an octal number. Similarly, Example 3.17
shows how to convert a binary number to a hexadecimal number. However, these are lengthy procedures and we
can use shortcut methods when we desire such conversions. These shortcut methods are described below.
&le 3.17.
110HXllh =116
Solution:
Step l : Convert 11010011 2 to base 10
110l00112 = l X 27 + 1 X 26 + 0 X i5 + l X i4 + 0 X i3 + 0 X i2 :I- l X 21 + l X 2°
= l x 128 + l x 64 + 0 x 32 + l x 16 + 0 x 8 + 0 x 4 + 1 x? + l x l
= 128 + 64 + 0 + 16 + 0 + 0 + 2 + 1
= 211 IO
16 211 Remainders
13 3 = 3 in Hexadecimal
0 13 = D in Hexadecimal
Hence, 110100112= D3 16