Introduction To Computer
Introduction To Computer
College)
Accuracy
Now a days computers are being used life-and-death situations (For example, jet pilots
rely on computer computations for guidance, Hospitals rely on patient-monitoring
systems in critical –care units) which needs almost hundred percent accuracy. From this
Note: Even if the above main characteristics of computers are increasing with time, the
cost and size of computers are decreasing.
Therefore, computers are applicable for any functions or process that requires these
abilities.
[Link] of Computers
We have all heard stories of primitive peoples counting their sheep by moving sticks or
stones. Our base ten number system undoubtedly grew from the use of 10 fingers as
counting objects. Together with the development of people, the need to calculate and
keep track of information had become popular issue. So they soon develop a simple
computing device and had a power of storing small information. However, many
thousands of years elapsed before developing mechanical calculator.
Some of the calculating devises are mentioned bellow:
a) The Abacus
It is one of the earliest mechanical computational devices. It was in use in the Middle
East as early as 2500 BC The familiar Chinese abacus ( dating approximately 1200 AD )
is composed of a frame and a number of wires. The wires correspond to position of digits
in a decimal number-units, tens, hundreds, and so on-and the beads represent digits.
Beads above the cross bar represent 5 and those bellow ,1.
The abacus shows zero, if all the bead bellow the cross bar are at the lower frame and
above are at the upper frame.
B) Pascal‟s calculator
It is the first true mechanical calculator.
In 1642, at the age of 19, the French philosopher and mathematician Blaise Pascal
developed a rotating wheel calculator, the predecessor of the latter popular desktop
calculator. He built largely to assist his father, who was a tax collector in the town of
Rouen, Pascal‟s calculator has one wheel corresponding to each power of 10; each wheel
has 10 position, one for each of the digits (0,..9). Although Pascal‟s calculator could only
add and subtract, it could be used indirectly for multiplication (by successive addition)
and division( by successive subtraction) as well.
E)Mark I: Developed by Howard Aiken at Harvard university (1944) which were the one
first electromechanical computer. Instruction were provided by means of punched paper
tape, which combined the functions of Babbage‟s operation cards and variable cards.
Each instruction had the format
A1 A2 OP where
A1 and A2 are registers storing the operands
OP is the operation to be performed( e.g. +,-,x,)
Mark I could do asingle addition in 6 seconds and division in 12 seconds
ENIAC did not use internally stored programs. Programs were wired on
boards similar to a telephone switch board.
One of the major drawbacks of ENIAC was that it had to be programmed
manually by setting switches and plugging and unplugging cables.
G) Commercial Computers
The 1950s saw the birth of computers industry with two companies, Spery and IBM,
dominating the market place. In 1947, Eckert and Mauchly develop their successful
commercial computer called UNIVAC I (Universal Automatic Computer ) .
UNIVAC was division of Remington Rand (later Sperry_Rand Corporation).
IBM also the majior manufacturer of punched card processing equipment ,delivered its
first electronic stored program computer, the IBM 701, in 1953.
from memory).
[Link] of computers
There are different types of Computers. Their difference is depending on
different categories of characteristics.
2. Digital Computers
Digital computers deal with discrete variables; they operate by counting
rather than measuring. They operate directly up on numbers (or digits) that
represent numbers, letters, or other special symbols.
Examples:
Abacus
Desk & pocket computers
The general purpose computers
Digital computers have higher accuracy and speed than the analog ones.
3. Hybrid computers
The best features of analog and digital computers can be combined into a
Example:
In hospital insensitive-care unit analog devices may measure a
patient‟s heart function, temperature and other vital signs. These
measurements may then be converted into numbers and supplied to a
digital component in the system. This component is used to monitor
the patient‟s vital signs and to send an immediate signal to the nurse‟s
station. If any abnormal readings are detected.
Computers can be applied or used for different purposes. Based upon their
application, they are classified as special purpose or general-purpose
computers
They are designed to solve a single type of problem, that is their components
and function are uniquely adapted to a specific situation involving specific
application.
Example:
The public telephone box
Traffic control system
2. General-purpose computers
They are designed to solve variety of problems through the use of “store
program concept”. A program or set of instructions designed to solve a
problem is read and stored into the memory and then executed by the
computer one by one. The same computer can be applied to solve another set
of problem using different program. General purpose computers are more
flexible and versatile.
Examples
Micro computers
Mini computers
Super computers etc.
Classification by physical size, price, capacity and performance
Super computers: - are the fastest, largest and most potential types of
computer.
Mini computers: - have relatively lower speed, can handle multi-users, are
smaller in size than the mainframe computers. They use terminals for inputs
and output. Mini computers are used in small organizations.
100
performance
Relative
10
We enter data into a computer or review (see) output data from a computer using the
letter of alphabet, various special symbols, and the numerals in the decimal number
system. But since computer is an electronic device which understands electrical flow
(signal) there is no letter, symbol or number inside the computer. Computer works with
binary numbers. As a semiconductor is conducting or isn‟t conducting; a switch is closed
or opened.
So data are represented in the form of a code which can have a corresponding electrical
signal.
Number System
For the purpose of understanding how data are represented, stored and
processed in computer, we will discuss only two of them, the Decimal and the
binary number system.
The Decimal number system is based on the ten different digits (or symbols)
CODING METHODS
There are different coding systems, that convert one or more character sets into computer
codes. Some are: EBCDIC, BCD, ASCII-7 & ASCII-8.
In all cases, binary coding schemes separate the characters, known as character set, in to
zones. A zone groups charactes together so as to make the coding scheme to decipher and
the data easier to process. With in each zone , the individual chatacters are indentified by
digit code.
EBCDIC: Pronounced as “Eb-see-dick” and stands for Extendede Binary Coded Decimal
Interchange Code.
Coding Examples
BCD (6-bits)
Stands for Binary Coded Decimal
It uses 6-bits to code a Character
Coding Examples
Character zone (2 BIT) digit(4 BIT)
0-9 0 0-9
A-I 3 1-9
BCD
Character Zone digits
A 11 0001
Q 10 1000
8 00 1000
9 00 1001
Coding examples:
ASCII-7
Character Zone digit
$ 010 0100
% 010 0101
A 100 0001
a 110 0001
b 110 0010
Coding Examples
BIT
Bits are the smallest units and can convey only two possible states 0 or 1;
bit stands for binary digits;
A bit is a single element in the computer, on a disk that stands for either “ON”
indicating 1 or “OFF” indicating 0;
In the computer “ON” is represented by the existence of current and “OFF” is
represented by the non existence of current
On a magnetic disk, the same information is stored by changing the polarity or
BYTE
Bits can be organized into large units to make them represent more and meaningful
information;
This large unit is called a byte and is the basic “unit of data representation” in a
computer system;
The commonly used byte contains 8 bits;
Since each bit has two states and there are 8 bits in a byte, the total amount of data
that can be represented is 28 or 256 possible combinations;
Each byte can represent a character(a character is either a letter, a number or a special
symbol such as +,-,?,*, $, etc
A byte is then used as a unit of measurement in the computer memory, processing
unit, external storage and during communication;
If the computer memory is 524288 byte, this is expressed in short by saying 512KB,
where KB stands for kilobyte.
1 Kilobyte(1KB) is 210 or 1024 bytes
1 Megabyte(MB) is 220 bytes or 210 kilobytes
1 Gigabyte(GB) is 230 bytes or 220 kilobytes or 210 megabytes
WORD
Word refers the number of bits that a computer process at a time or a transmission
media transmits at a time
Although bytes can store or transmit information, the process can even be faster if
more than one byte is processed at a once;
A combination of bytes, then form a “word”
A word can contain one, two, three or four bytes based on the capacity of the
computer;
Word length is usually given in bits
Data processing
Data processing is the activity of converting row facts ( data) in to information. Data
processing may involve any number of the following steps:
Data collection: means gathering original data to be entered in to the information
ststem. Examples: - filling out evaluation paper of instructors
Gathering the # of hours each week that hourly employee worked is
essential to calculating the weekly payroll.
Data entry( recording) : it is the processof expressing data in a form that is
recognizable by either person or machine. This is accomplished by input device of
the computer.
Objectives:
What a computer system is and how it works to process data
Computer hardware is the physical part of the computer that you see, you use to and the
parts you can touch.
OUTPUT
Hardware
Programs
Input data Out put
Buffer Buffer
Primary
Memory
SECONDARY
Introduction to computer Science STORAGE DEVICE ROM 32
4.1.1. The Central Processing Unit (CPU)
Instruction
register
flags Control
unit
As the name implies, it performs all the control functions of the computer.
It retrieves the instruction from memory.
Translates those instructions into computer functions and sends signals to other
computer hardware units to carry out those functions.
It is also responsible for determining the next instruction to be executed by the
computer.
In general it serves as the computer traffic cope.
Registers are paths or conduits that connect the Arithmetic Logical Unit to the main
memory.
When an instruction loaded from main memory, it is placed first in the register to wait
instructions from the control unit.
Data are also stored in registers prior to execution in the ALU.
Input Unit
Is the unit used to enter data into the computer so that it can be processed.
It converts information from a form suitable to human beings to one understandable
by the computer.
Examples of input devices;
Optical Recognition Systems fall into two categories. The first and most advanced are the
Optical Character Recognition (OCR) systems, which are able to recognize hand-printed
and typewritten characters. The second type of optical character recognition is referred to
as Optical Mark recognition (OMR). OMR doesn‟t utilize letters of the alphabet. Instead,
with the use of electronic scanners, marks and symbols are converted into appropriate
electronic signals. A typical example of an OMR application would be computerized test
forms. OMR systems are also used to read bar codes such as the Universal Product Code
(UPC).
Used to get data out of a computer so that it can be examined, analyzed or distributed
to others.
Convert the result of the only-machine understandable form to a form understandable
by human beings.
Examples
We have seen that there are different components of a computer and each performs a
specific function. But to perform a given task in synchronized form there should be some
mechanism of communication. For this reason there is an electronic circuit which
produces communication path between the different components of a computer system
along which data are transferred, that is Bus. The bus, which communicates the different
parts of the CPU is called Internal Bus. And the bus, which communicates the CPU with
memory and peripheral devices is called External Bus. The size of the bus determines the
speed of efficiency of the computer.
Address Bus
Data Bus
Control Bus: - a bus used to select and enable an area of main storage and transmit
signals required to regulate the computer operation.
Secondary Storage:- secondary storage or auxiliary storage, can take many forms, which
have traditionally included punched cards, papers tape, magnetic tape, magnetic disk and
magnetic drum.
Punched Cards
Punched cards are one of the oldest and most familear forms of data storage. There are
two types of punched cards, 80 – columns and 96 – columns and the first one is a
standard punched card. Using one card we can represent 80 characters.
Punched paper tape is a continuos strip of paper used to store data in much the same
manner as punched cards. The paper tape is approximately one inch wide & can have
either six or eight channels. Eight channels paper tape is based on the ASCII code. This
storage media is less expensive and more compact than punched cards.
Magnetic tapes are a particularly popular form of secondary storage because of their high
data density (the number of bytes of instruction per inch of tape) and their convenience in
handling. Magnetic tapes are approximately one - half inch wide are made of Mylar –
based plastic film which can be magnetized. Data are stored on a magnetic tape by
running the tape over the electromagnetic called read/write head which magnetizes small
spots on the tape. Seven-track tapes store information as bytes of information, where each
byte consists of a six-bit code and a one-bit parity bit. Nine-track tape use an eight-bit
and a parity bit.
An 800 bytes per inch density of magnetic tape and has a length of 100 inch can store
80,000 bytes of information.
Magnetic disks
Magnetic disks are metals or plastic platters coated with ferrous oxide, an easily
magnetizable material. Magnetic disks allow for random access of information and
overcome the slow access time commonly found in tape files.
Track
The most widely used type of floppy disks are the 5.25 inch and the 3.5 inch floppy disks.
Each have two standard sizes.
5
2
1. Disk Hub:- is the portion of the1disk that the disk drive used to rotate the disk
2. Write protect Notch (opening):- for the 5.25 inch floppy disk when the
6
notch is
4
uncovered, the disk‟s data can be modified. When the notch is covered with a write
3
protect tab (provided with the disk) the contents of the disk can‟t be modified, which
prevents accidental file deletion (although can still be read and copied). For the 3,5 inch
floppy disk, when the opening is open (uncovered0, the contents of the disk can not be
modified, which prevents accidental file deletion( although the disk can still be read
and copied). When the opening is closed the disk‟s data can be modified and data can
be written on the disk
3. Disk jacket:- the jacket surrounding the disk protects the storage media from dust,
finger prints and scratches from other sources.
4. Read/ Write opening:- allows the read/write head inside the disk drive access to the
storage media. As the disk rotates in the disk drive, the read/write head within the drive
accesses the information contained on the disk via this opening.
5. Disk label:- is used to label the disk so as to identify the data stored on it.
6. Shutter:- a moveable metal or plastic plate that protects the disk media from dust
Floppy disks are magnetic devices which stores data on them. Improper handing of
floppy disks may result in loosing the data stored on the disk. It is therefore necessary to
know the following rules to protect your disks and/or your data on it from damage.
Disk drive:- is part of a computer system which reads from and writes data on a disk.
Hard Disk
A high capacity magnetic disk made up of metal which can be fixed in the system
unit of the computer.
Serves as a secondary storage.
Enables very fast accessibility of data.
Accessing data from hard disk is faster than from floppy disks.
The disks, which are usually grouped together into a disk pack are separated by small
air spaces to allow access for read/write head.
Each disk has approximately 200 tracks on which information is stored. Tracks of the
small number on all adjacent disks are referred to as a cylinder of that disk.
The disk pack is mounted on a magnetic disk drive which rotates the disk at speed up
to 1,000 revolutions per second.
Cross section of a disk pack
The total collection of tracks available on one movement of the access mechanism is
known as cylinder.
The amount of time it takes to retrieve (or store) data from (or to) disk is called the
disk access time.
The computer hardware is an electronic device which has the potential of performing the
task of solving a problem. However one has to give precise instructions to the hardware
in order to solve problem.
The finite set of instructions (steps) that the computer follow to perform a given job is
called a program.
USER
Software
Hardware
Constitutes those programs which facilitates the work of the computer hardware.
It organizes and manages the machine‟s resources, handles the input/output devices.
It controls the hardware by performing functions that users shouldn‟t have to or are
unable to handle.
System programs make complex hardware more user friendly.
Operating system coordinates the activity between the user and the computer. An
operating system has three major functions.
The I/O manager coordinates the computers communication with outside world, flow
of data to the display screen and other output devices (printers/ plotters) and from the key
board or other input devices.
Handles the flow of data to and from the disk drives (file management).
Handles the process of preparing a disk for use, the copying, renaming, erasing task
of a file.
It interprets the commands or what you enter using the keyboard or other input
devices.
If you write an internal command it carries out the function of that command if it is
external command or other executable file it searches for the corresponding file in the
default (current disk) or the user specified disk, loads the file into memory and transfers
control to that program. Once this program is terminated, control returns to
[Link] and the program for that command or file is discarded from memory.
With single tasking operating systems only one program can be run on a computer at
a time.
In order to run another program, one must remove the first program loaded in the
computers main memory and load the other one(i.e. it can‟t handle two or more
programs at a time)
These types of operating systems are single user or can serve only one user at a time.
A real time is a system that is capable of processing data so quickly that the results
are available to influence the activity currently taking place.
Is a software that is designed to perform tasks for the specific area or areas. But for
use in more than one installation.
Are usually called application packages as they may include a number of programs
along with operating instruction, documentation and so forth.
Depending on their function or task they are categorized in to the following.
The processors
In large computers like mainframe and mini computers, the processor is often called a
Central Processing Unit (CPU).
In mini computer or personal computer the processor is sometimes called
Microprocessor or just processor
A microprocessor is a semiconductor device consisting mostly one software
controlled LSI chip which performs the functions of automatic data processing.
Processors are not optimized to perform complex numerical calculations and other
special tasks (graphics manipulations). For this purpose specialized coprocessors which
are also called math-coprocessors have been developed to increase the processing
capability of a computer and speed up complex mathematical floating-point calculations
The coprocessors operate in parallel with CPUs.
Examples are: 8087, 80287, 80387 and 80487
Family of processors
The first processor, Intel 4004, a 4-bit microprocessor, was introduced in 1971 by
Intel Company.
An 8-bit microprocessors were introduced by a number of companies:
- The Motorola‟s Mc 6809 Microprocessors
Motorola Microprocessors
Microprocessor Word length Clock frequency
6800 8-bit 1 MHz
6809 8-bit 4-8 MHz
68000 16/32 bit 10-25 MHz
68020 32-bit 12.5-33 MHz
68030 32-bit 20-33 MHz
We enter data into a computer or review (see) output data from a computer using the
letter of alphabet, various special symbols, and the numerals in the decimal number
system. But since computer is an electronic device, which understands electrical flow
(signal) there is no letter, symbol or number inside the computer. Computer works with
binary numbers. As a semiconductor is conducting or isn‟t conducting; a switch is closed
or opened.
So data are represented in the form of a code that can have a corresponding electrical
signal.
2.1 Number System
For the purpose of understanding how data are represented, stored and processed in
computer, we will discuss only two of them, the Decimal and the binary number system.
The Decimal number system is based on the ten different digits (or symbols)
0,1,2,3,4,5,6,7,8,9.
We say it is a base ten number system
The most elementary form to organize data within a computer (an electronic device) is in
the form of a code which utilizes the “ON” and “OFF” states of electric switches or there
is “current” and “no current” condition of the electronic components;
We see that the nature of the electronic devices has similarity with the binary number
system in that both represent only two elementary states;
It is therefore convenient to use binary number system to represent data in a computer;
An “ON” corresponds to a 1; An “OFF” corresponds to a 0;
In the computer “ON” is represented by the existence of a current and “OFF” is
represented by non existence of current
On a magnetic disk, the same information is stored by changing the polarity of
magnetized particles on the disk‟s surface.
There are different coding systems, that convert one or more character sets into computer
codes. Some are: EBCDIC, BCD, ASCII-7 & ASCII-8.
In all cases, binary coding schemes separate the characters, known as character set, in to
zones. Zone groups characters together so as to make the coding scheme to decipher and
the data easier to process. With in each zone, the individual characters are identified by
digit code.
EBCDIC: Pronounced as “Eb-see-dick” and stands for Extended Binary Coded Decimal
Interchange Code.
Used usually for IBM Main frame model and in similar machines produced by other
manufacturer.
BCD (6-bits)
It uses 6-bits to code a Character (2 for zone bit and 4 for digit bit) it can represent 2 6 =
64 characters (10 digits, 26 capital characters and some other special characters).
5 ASCII-7
a 0110 0001
b 0110 0010
A 0100 0001
B 0100 0010
? 0011 1111
+ 0010 1011
8 BIT
Bits are the smallest units and can convey only two possible states 0 or 1;
Bit stands for binary digits;
A bit is a single element in the computer, on a disk that stands for either “ON”
indicating 1 or “OFF” indicating 0;
In the computer “ON” is represented by the existence of current and “OFF” is represented
by the non-existence of current
On a magnetic disk, the same information is stored by changing the polarity or
magnetized particles on the disk‟s surface;
9 BYTE
Bits can be organized into large units to make them represent more and meaningful
information;
This large unit is called a byte and is the basic “unit of data representation” in a computer
system;
The commonly used byte contains 8 bits;
Since each bit has two states and there are 8 bits in a byte, the total amount of data that
can be represented is 28 or 256 possible combinations;
Each byte can represent a character (a character is either a letter, a number or a special
symbol such as +,-,?,*, $, etc
A byte is then used as a unit of measurement in the computer memory, processing unit,
external storage and during communication;
If the computer memory is 524288 byte, this is expressed in short by saying 512KB,
where KB stands for kilobyte.
1 Kilobyte (1KB) is 210 or 1024 bytes
10 WORD
Word refers the number of bits that a computer process at a time or a transmission media
transmits at a time
Although bytes can store or transmit information, the process can even be faster if more
than one byte is processed at a once;
A combination of bytes, then form a “word”
A word can contain one, two, three or four bytes based on the capacity of the computer;
Word length is usually given in bits
We say that a computer is an 8-bits, a 16 bit, a 32 bit or a 64 bit computer to indicate that
the amount of data it can process at a time;
The large the word length a computer has the more powerful and faster it is.
We have seen the binary and decimal number system in the previous chapter, so we will
discuss the next two in this chapter.
When we compare the octal with the decimal, 0-7 in octal is the same as 0-7 in decimal
but 10 in octal is not the same as 10 in decimal because 10 in octal holds the position of
8 in decimal, off course 10 in octal is the same as 8 in decimal.
Example
DECIMAL OCTAL BINARY HEXADECIMAL
0 0 0 0
3 3 11 3
8 10 1000 8
10 12 1010 A
16 20 10000 10
To convert binary to hexadecimal group four binary digits together starting from right
and if there are no enough digits add zeros at the left.
EX. Convert 111100100 to hexadecimal Convert 111001111 to Hexadecimal
111100100 =0001 1110 0100 111001111 =0001 1100 1111
=1 14 4 =1 12 15
=1 E 4 =1 B F
= 1E416 =(1BF)16
To convert from Octal to binary, convert each octal digit to its equivalent 3 bit binary
starting from right.
EX. Convert (675) eight to binary Convert 231eight to binary
=110111101two =10011001two
To convert from Hexadecimal to binary convert each hex. Digit to its equivalent 4-bit
binary starting from right.
Ex. Convert 23416 to binary Convert 2AC to binary
23416 =0010 0011 0100 2AC16 =0010 1010 1100
= 10001101002 =10101011002
Group three/four digits together starting from the last digit of the integer part, and if
there is less number of digits add some zeros in the beginning.
Group three/ four digits together starting from the first digit of the fractional part, and
if there is less number of digits add some zeros to the end.
Covert each group of the integer and the fractional part to their equivalent
Octal/hexadecimal and collect the results by adding point (.) to separate the integer part
from the fractional part.
Ex 1:- Covert 1010.01112 to octal
Ex2:- Covert 1110101.101112 to hexadecimal
65
To convert from Octal/hexadecimal to decimal, first convert to binary and –then the
binary to decimal.
Remark: -
BCD numbers are useful whenever decimal information is transferred into or out of a
digital system. Examples of BCD systems are electronic ousters, digital voltmeter, and
digital clocks; their circuits can work with BCD numbers.
BCD‟s are easy for conversion but slower for processing than binary. And they have
limited numbers because with BCD we can represent only numbers 0000 for 0 and 100
for 9 and ,1010,1011,1100,1101,1110, 1111 can‟t be used because 1010 represent 10 in
decimal at 10 in decimal is 1010 0000 in BCD.
Hexadecimals are used for computation and memory addressing.
11.3 Binary Arithmetic
Computer understands only the language of binary numbers. Therefore, the machine
performs what is called binary arithmetic (binary computation).
Binary addition operates by the same rule as decimal addition, except that it is simpler. A
carry to the next higher order (or more significant) position occurs when the sum is
decimal 2, that is, binary 10. Therefore, the binary addition rules may be written as
follows:
0+0=0
0+1=1
1+0=1
1+1=0 plus a carry of 1 into the next position
1+1+1=1 plus a carry of 1 into the next position.
The last case occurs when the two binary digits in a certain position are 1s and there is a
carry from the previous position.
Example1:
6+7 =13
66
110+111=1101
Example2
19+31+10=60
10011 +11111+1010=111100
That is, the process for dividing one binary number (the dividend) by another (the
divisor) is based on the rules for binary subtraction and multiplication and Similar to
decimal division
67
Ex 1111101 11001
11001 101
11001
11001
00000
1111101 ÷ 11001 = 101
11.4 Representation of Negative numbers
In signed binary representation, the left-most bit is used to indicate the sign of the
number. Traditionally, 0 is used to denote a positive number and 1 is used to denote a
negative number. But the magnitude part will be the same for the negative and positive
values. For example 11111111 represents-127 while, 01111111 represents + 127. We
can now represent positive and negative numbers, but we have reduced the maximum
magnitude of these numbers to 127.
In a 5- bit representation we use the first bit for sign and the remaining 4- bits for the
magnitude. So using this 5 bit representation the range of number that can be represented
is from -15 (11111) to 15(01111)
68
i.e. 2 n-1 + 1 to 2 n-1 –1
Note:
In sign magnitude representation zero can be represented as 0 or -0
This representation has two problems one is it reduces the maximum size of magnitude,
and the second one is speed efficiency to perform arithmetic and other operations.
For sign magnitude representation, correct addition and subtraction are relatively
complex, involving the comparison of signs and relative magnitude of the two numbers.
Ex: +2 is 00000010
-2 is 11111101
Note that in this representation positive numbers start with a 0 on the left, and negative
numbers start with a 1 on the left most bit.
Ex1. add –3 and 3 with word size 4
3 = 0011
-3=1100
sum =1111 (=0)
Ex2. Add -4 and +6
- 4 is 11111011
+ 6 is 00000110
the sum is (1) 00000001 the one in the parenthesis is the external carry.
69
In one‟s complement addition and subtraction, if there is an external carry it should be
added to get the correct result. This indicates it requires additional circuitry for
implementing this operation.
If we ignore the external carry the result is 00000001 ( i. e 1 In decimal). This is the
correct result. In two‟s complement, it is possible to add or subtract signed numbers,
regardless of the sign. Using the usual rules of binary addition, the result comes out
correct, including the sign. The carry is ignored. One‟s complement may be used, but if
70
one‟s complement is used, special circuitry is required to “ correct the result”.
Where 1 indicates a carry. The result requires a ninth bit (bit 8, since the right- most bit
is 0). It is the carry bit.
The two‟s complement representation has one anomaly not found with sign magnitude or
one‟s complement. The bit pattern 1 followed by N-1 zeros is its own 2‟s complement.
N
To maintain sign bit consistency, this bit pattern is assigned the value –2 for example,
for 8-bit word,
-128 = 10000000
its 1‟s complement =01111111
+1
=100000000 = -128
Overflow indicates that the result of an addition or subtraction requires more bits than are
available in the standard 8-bit register used to contain the result.
Fixed format representation: We now know how to represent signed integers: however,
we have not yet resolved the problem of magnitude. If we want to represent large
integers, we will need several bytes. In order to perform arithmetic operations efficiently,
it is necessary to use a fixed number of bytes, rather than a variable number. Therefore,
once the number of bytes is chosen, the maximum magnitude of the number that can be
represented is fixed.
71
11.5 Subtraction by use of complements.
Complements are mainly used for representing negative numbers and subtraction.
In performing binary subtraction or addition of negative number by use of binary
complements only one procedure, addition, is needed as one can subtract by adding its
complements.
To subtract any number, positive or negative, substitute the required complement for
the numbers to be subtracted and then add.
If the result is
An ( n+1)-bit number, and the arithmetic is in
Ones complement the (n+1) th bit, a carry, is added to the right most bit of the result.
This process is called an end-around carry.
Two‟s complement discard the (n+1) th bit.
* Arithmetic overflow occurs when the sign bits of A and B are the same but the sign
72
11.6 Floating-Point Representation
In this representation decimal numbers are represented with a fixed length format. In
order not to waste bits, the representation will normalize all the numbers. For example,
0.000123 wastes three zeroes on the left before non -zero digits. These zeroes have no
meaning except to indicate the position of the Decimal point. Normalizing this number
-3
result in .123x10 .123 is the normalized mantissa; -3 is the exponent. We have
normalized this by eliminating all the meaningless zeroes to the left of the first non-zero
digit and by adjusting the exponent.
E
The general form of floating point representation is Mx10 where M is the mantissa,
and E is the exponent. It can be seen that a normalized number is characterized by a
mantissa less than 1 and greater than or equal to.1 all cases when the number is not zero.
In representing a number in floating point we use 1 bit for sing, some bits for exponent
and the remaining bit for mantissa.
73
In floating point representation the exponent is represented by a biased exponent
(Characteristics).
n-1
Biased exponent = true exponent + excess 2 , where n is the number of bits reserved for
the exponent.
Ex1.
Represent –236.375 in floating point using 7 bit for exponent and 16 bit for mantissa.
First we have to change to normalized binary
i. e 234 = 11100010
0.375= 0.011
234.375 = 11100010.011 = 0.11100010011x28
true exponent = 8
excess 2 n-1 = 2 7-1= 26= 64
Biased exponent = 8+26 8+64 = 72
= 100 1000 2
Therefore –234.375 is represented as
1 1001000 1110001001100000
Ex2. Represent 34.25 in floating point using 7 bit for exponent and 24 bits
for mantissa.
34.25 = 1000 10.0 12
The normalized form of 34.25 = .10001001x 26
n-1 7-1 6
True exponent = 62 =2 = 6+2
=6+64=70
70 = 10001102
74
0 1000110 100010010000…..
0
-M
-(1-2 )x2n-1 -0.5x2
-n
0.5x2
-n
(1-2
-M
) x2n-1
Ex1. Find 23.375+ 41.25 using 7-bit for exponent and 10 bit for mantissa.
5 6
23.375 = 10111.011 = 0.1011101x2 = 0.010111011x2
75
41.25 = 111001.01 = 0.11100101x26
23.37+41.25 = 0.01011101x26+0.1110010x26
= (0.010111011+0.11100101)x26
= 0.1010000101x26
76
Chapter 6
12 Computer System Architecture
Objective:-
To know the different layers of a computer system
To know the basic building blocks of computer and how they work.
Actually a computer system composed of many layers of software and hardware. But
for simplicity we see the computer in Abstract way. This avoids details and makes the
user to concern about the outer layer that is easy for the user to communicate with the
computer.
Generally modern computers consist of multi-layers or levels. The following figure
shows the different levels.
77
12.2 Logic gates(elements)
In the hierarchical structuring of a computer the logic gate level is above the device level.
These logical elements are primary components of the computer hardware. Given a
desired function, Boolean algebra can be applied to develop a simplified implementation
of that function using interconnection of logical gates.
A gate is an electronic circuit that produces an output signal that is a simple Boolean
operation on its input signals. The basic gates used in digital logic are AND, OR, NOT,
NAND, and NOR. We ha also XOR gate for defining Boolean algebra with other gates.
Each gate is defined in three ways: graphical symbols, algebraic notation, and truth table.
A truth table is a table that shows the output of a logical function for all possible
combinations of input values.
Each gates has one/two or more inputs and only one-output signals. The signals are either
0 or 1. When the values at the input are changed, the correct output signal appear almost
instantaneously, delayed by the propagation time of signals through the gate (known as
gate delay)
It is a mathematical abstraction of a physical device that we can boiled to perform the
function of a truth table
Gate Name Graphical symbol Algebraic notation Truth table
NOT (inverter)
X X
X 1 0
0 1
OR X+Y
AND
X.Y or XY
NAND
X.Y
=NOT(AND)
NOR
X+Y
=NOT(OR)
XOR (Exclusive OR)
X +Y
78
Typically, not all gate are used in implementation. Design and fabrication are simpler if
only one or two types of gates are used. Thus it is important to identify functionally
complete set of gates. This means that Boolean function can be implemented using only
the gates in the set. AND OR and NOT gates constitute functionally complete set because
they represent the three operation of Boolean algebra. If there are any functionally
complete sets of gates, they should synthesize these sets of Boolean operators.
List of functionally complete set of gates:
AND, OR, NOT
AND, NOT
OR, NOT
NAND
NOR
It is preferable to construct circuitry system using only NAND or NOR gates.
EXERCISES:
1. Show that, all these are functionally complete set of gates.
2. Construct XOR gate using only NAND gate.
3. Construct XOR gate using only NOR gate.
X=x
x =x Double Negative
A +AB =A A(A +B)= A
To construct the logic circuit of a Boolean equation first we have to simplify the Boolean
function using the rules of the operators ( theorems)
80
12.4 Construction of logical circuit from logical function and truth table
Any Boolean function can be implemented in electronic form as a network of gates. If
you have the truth table you can generate the Boolean function and you can also use the
Boolean function to construct the logical circuit. The reverse is also possible.
81
Construct a logical circuit and logical functions using the following truth table
A B A‟ B‟ F
0 0 1 1 1
0 1 1 0 0
1 0 0 1 1
1 1 0 0 0
A‟B‟+AB‟
(A+B‟)(A‟+B‟)
Ex. Construct the logic circuit of
F(x,y) =x +y + x y + ( x+ y) x y
Factoring to simplify
Y = AB C D + AB CD + AB C D + ABCD
= BCD ( A + A) + ABCD + ABCD
82
= BCD + ABCD + ABCD
= CDC (B + AB) + ABCD
83
12.5 Types of circuit
There are two types of circuits in designing logical circuits: Combinational circuits and
sequential circuits.
Combinational circuits are circuits that constitute interconnection of sets of gates whose
output at any time is a function of only the function of only the input at that time. In
general terms, a combinational circuit consists of n binary inputs and m binary outputs.
Combinational circuits implement the essential functions of a digital computer. However,
except for the special case ROM, they provide no memory or state information.
Examples: ADDER, ROM, PLA (Programmable Logic Array), Decoder, Multiplexers,
etc.
Sequential circuits are circuits which are designed to have a memory or state information
(i.e. the current out put of sequential circuit depends on the current input and the current
state of that circuit).
Examples: Flip-Flop, Registers, Counters, etc.
I. Half adders
The simplest form of electronic binary arithmetic is performed in a half adder circuit. A
half adder circuit adds 2 bits and generates sum and carry output bits. Binary addition
differs from Boolean algebra in that the result includes a carry term.
A B S Co
0 0 0 0
0 1 1 0
1 0 1 0
1 1 0 1
84
S= A + B – sum output
Co = AB – carry output
[Link]
[Link]
II. Full-Adders
We are not interested in performing addition on just a single pair of bits. Rather we wish
to add two n bit numbers. This can be done, by putting together a set of adders so that the
carry from one adder is provided as input to the next. The circuitry that can perform
complete binary addition is called full adder.
It accepts three separate inputs bits, the two bits to be added and a carry in.
Sum = A + B + C
Carry = AB + AC + BC
Construct the logic circuit for Sum and Carry of full adder
Truth table
A B Ci Carry Sum
0 0 0 0 0
0 0 1 0 1
0 1 0 0 1
0 1 1 1 0
1 0 0 0 1
1 0 1 1 0
1 1 0 1 0
1 1 1 1 1
85
Exercise Construct a binary adder of 4-bits
Ex 1 1001 A3A2A1AD
1011 B3B2B1A0
10100 C4S3S2S1S0
A3 A2 A1 A0
B3 B2 B1 B0
C4 FA C3 FA C2 FA C1 HA
S3 S2 S1 S0
Combinational circuits are circuits whose output is determined by the current input
(signal) where as sequential circuits are circuits whose output is determined by the
current input (signal) and the previous state of the circuits so sequential circuits have
memory to store their previous state.
A flip fop is the simplest form of sequential circuits. There are variety of flip-flops, all of
which share two properties:
Flip flops are bitable devices. It exists in one of two states and, in the absence of
inputs, remain in that state. There fore a flip flop can function as a 1 bit memory.
The flip flop has two outputs, which are always the complements of each other.
These are generally labeled Q and Q.
The different types of flip flops are S-R latch, Clocked S-R Flip flop, D flip flop, and J-K
flip flop. In this course we will see only the S-R latch (flip flops).
The circuit show that it has two inputs S (set) and R(reset) and two outputs Q and not(Q)
and consists of two nor gates hooked together in a feedback arrangement.
Set-sets to one
86
The SR-latch can be defined with a table similar to truth table, called characteristics table,
which shows the next state or states of a sequential circuit as a function of current state
and inputs. In the case of S-R latch, the state can be defined by the value of Q. The value
for the inputs S=1 and R=1 are not allowed, since these would produce an inconsistent
output (Both Q and not (Q) equal 0).
Truth table
R S Q
0 0 NC
0 1 1
1 0 0
1 1 *
87
Chapter 7
13 Data: Communications and Networks
Objective:
To know basic component used in data transmission
To know, what a computer network is and different protocols of networks
To know what is Internet and what service Internet has.
The need of information has increased from time to time. This leads to the need of
sharing of information among different agents (individual). Which may be at different
places or locations Date communication is the exchange of information between tow
agents. For exchange of information the information should be transmitted from one
point to another through a transmission media called Channel. The following figure
shows the different components of data communication.
88
The transmission medium may be physical (it connects the transmitter and receivers
through wire) or logical ( The are different mode of transmission)
A channel is a medium that carries a signal from the transmitter to the receiver. The range
of frequencies that can be transmitted over a transmission medium is called band Width
of a channel width. The rate of data transmission is directly proportional to the
bandwidth.
A/Narrowband: It is the smaller band and has slow data transmission rate Ex Telegraph
line.
B/Voice band: It is the wider band and has better data transmission rate than the narrow
band. Ex telephone lines are used for voice band channel
C/Broadband: It is the widest band has used to transmit large volume of data with high
speed, Ex. (Oxide cable such as TV aerial lead), circuits, communications sate bites and
optical fibers are used for broadband channels.
89
A local area network is a network confined to a small area like a building. Most LAN
have communication stations that are physically linked by a cable. WAN are used to
connect computers not located in the same building ( or even in the same city. High-
speed dedicated data lines or satellite connections may be used to link computers
separated by great distance.
There are three main network topologies; bus, ring and star. [ figure]
Bus topology:- In bus topology, all stations attach through appropriate interfacing
hardware, directly to a line as transmission medium, or bus. A transmission from any
station propagates the length of the medium in both directions and can be received by all
other stations. The message that is transmitted contains the address of the station and the
data and each station monitors the medium and copies packets addressed to itself.
Because all stations share a common transmission link, only one station can successfully
transmit at a time, duo some form of medium access control technique is needed to
regulate access.
Ring topology:- In the ring topology the network consists of a set repeaters joined by
point –to point links in a closed loop. The links are unidirectional, that is, data are
transmitted in one direction only, and all oriented in the same way. The data circulates
around the ring in one direction ( clockwise or counter clockwise). Data are transmitted
in packets inserted into the ring by the stations. The packet contains source and
destination address as well as other control information and user data. As a packet
circulates, the destination station copies the data. Typically, the packet continues to
circulate until it returns to the source station, where it is absorbed, removing it from the
ring. Since the medium is shared it needed to control the order and timing of packet
transmission.
Star topology: In star topology, each station is directly connected to a common Central
Switch ( host). Each station transmits its message to the host and the host delivered the
message to the correct distribution by identifying the address. The problem with star is if
the host fails there will not be any communication.
The transmission medium can be twisted pair coaxial cable, optical fiber. The main
difference among the transmission medium is cost, speed and technology.
90
Decentralized information system
Each independent decision making unit can control its own data and information
processing activities.
Distributed information system is a management of information system that take both of
these factors into account.
In a network, computer systems that have several interconnected processors which are
physically dispersed can operate together. Each processor can have its own local
peripherals ( disks, printers, terminals) in addition to any peripherals attached to some
centered processor. Such a system which looks a single complete to its users is more
accurately described as a distributed system.
Large-scale
Computer system
Computer system
Internet is a wide area network, which is the network of networks. Internet has a lot of
services.
E-mail is one of the most widely used services on the internet, E-mail is easy to send,
read, reply to and manage, and it is fast and convenient. E-mail is also global, allowing
menages to pass from Japan to the U.S in minutes, regardless or the time they were sent.
It is much cheaper to send an e-mail menage then a letter, or to make a long distance
telephone call. Another advantage of e-mail is, it is possible to send the same message to
any number of individuals as long as you know their e-mail address.
91
World Wide Web ( WWW):- Is one of the newest Internet services. The WWW allows
you to combine text, a video, graphics, and even animation to make a document a
viewed easy. Links within WWW documents can take you quickly to other related
documents. WWW is a set of sites that you can go o for information.
To access the WWW, it is necessary that you run a WWW browser on your computer.
Use Net:- It is one of the Internet services which allows users from any where on the
Internet to participate a discussion groups ( News groups). It is an organized electronic
mail ( e-mail) system, except there is no single user that mail is sent to. Instead, the
menages you and every one else using Use Net write are sent to a newsgroup section,
available for anyone who accesses that news group.
Telnet:- It is a program that lets you log into a remote computer directly through the
Internet and you can work on that computer.
This enables you to examine the files of remote hosts on the Internet and to transfer files
b/n your hosts and the others. Using FTP programs we can upload or download files. But
to do this there should be an admission from the remote computer.
Video Conferencing:- The internet is, in its raw form, communication. Video
conferencing means making a conference on the Internet by individuals who live in
different locations. The individuals speak and see each other.
92
Chapter 8
14 Problem Solving Using Computers
Computer programming is the art of conceiving a problem in terms of the steps to its
solution and expressing those steps as instructions for a computer system to follow. We
stress the two parts to this definition.
The first part focuses on defining the problem and logical procedures to follow in
solving it. (Task of system analyst)
The second introduces the means by which programmers communicate those
procedures to the computer system so that it can be executed. (Work of
programmers).
System analyst use system analysis and design tools, particularly flowchart and
structure chart, to define the problem in terms of the steps to its solution. The
programmer use programming language to communicate the logic of the solution to
the computer. Programming language is a collection of commands that direct the
control of the computer system. Like a human-to-human language, programming
languages contains a number of rules of expression called syntax.
Program is a logical set of instructions that tells the computer what steps to take to solve
a problem.
Computer solves varieties of problems that can be expressed in a finite number of steps
leading to a precisely defined goal by writing different programs. A program is not
needed only to solve a problem but also it should be reliable, (main trainable) portable
and efficient. This is met by program design using techniques of software engineering.
a) Analysis:
This stage concerns with a deep understanding of the problems,
Which part of the problem is going to be solved?
93
What input data are needed to the problem?
What procedures needed to achieve the result?
What outputs data are expected?
There are different ways of describing the algorithm but the most common ones are
verbal form, using any of existing human languages and flow chart. A flow chart
consists of an ordered set of standard symbols (mostly, geometrical shapes) which
represent operations, data flow or equipment. There are two types of flow charts.
System flowcharts the overall logic of data processing system. A program flow chart
shows the operations and logical decisions of a computer program.
Input/ output Used to represent data input or data output from a computer
94
one operation to another
On-page is used for connecting two points in connector a flow chart
without drawing flow lines In one page.
Off page It is used an exit to or any entry from another part of the
connector flowchart on another page
Example 1:- Draw flow chart of an algorithm to add two numbers and display their
result.
Algorithm description
Read the rules of the two numbers (a and b)
Assign the sum of A and B to C
Display the result ( c)
Now the flow chart is [Link].1 S
t
a
Read a, b r
t
[Link].3 C
=
[Link].4.1 aP
r
+i
n
[Link].5 S bt
t C
Ex 2:- Write an algorithm description and draw a flow
o chart to find the following sum.
Sum = 1+2+3+4 p
95
Ex2:- Write an algorithm description and draw a flow chart to check a number is
negative or not algorithm description.
1/ Read a number x
2/ If x is less than zero write a message negative
else write a message not negative
[Link].6.1 S
t
Read x a
r
t Print message
Write not X<0 write negative
negative
No Yes
[Link].6.3 S
t
Some times there are conditions inowhich it is necessary to execute a group of statements
p satisfied. This condition is called a loop. Loop is a
repeatedly. Until some condition is
sequence of instructions which is repeated until some specific condition occurs.
A loop normally consists of four part. There are:-
Initialization:- Setting of variables of the computation to their initial valves and setting
the counter for determining to exit from the loop.
Computation:- Processing
Test:- Every loop must have some way of exiting from it or else the program would
endlessly remain in a loop.
Incrementation:- Re initialization of the loop for the next loop.
[Link].6.5 Initializatio
n
Test Stop
Finished
[Link].6.7 Computatio
n
[Link].6.9 Incre 96
menta
tion
Ex:- Write the algorithmic description and draw a flow chart to find the following sum.
Sum = 1+2+3+…. + 50
1. Initialize sum too and counter to 1
2. If the counter is less than or equal to 50
Add counter to sum
Increase counter by 1
Repeat step 2
Else
Exit [Link].6.12 S
3. Write sum t
a
r
Sum = 0
t
Counter =1
No
Sum = Sum + counter Stop
Counter Counter + 1
Ex2: Write a flow chart to find sum of the first N positive numbers.
Ex 3 Write a flow chart to find n!
Exercise Find the following sum
Sum = 1: +2! +3! +…+n!
Ex4 . Draw a flow chart that accepts a salary of an individual and calculate pension,
income tax and net salary and display the results.
Pension = 10%
97
I.T equals 0% for salary between 0-119
10% 120-599
20 % 600-1200
30 % above 1200
c) Coding
The flow chart is independent of programming language. Now at this stage we translate
each steps described in the flow chart ( algorithm description) to an equivalent instruction
of target programming language, that means, for example if we want to write in Pascal
program language, each step will be described by an equivalent Pascal instruction (
Statement).
d) Implementation
This is the final stage where the program is debugged for error, tested and documented
then placed for actual work.
e) Maintenance
Some time it may be needed to modify the program so that it accommodates new things
and it becomes efficient, and this can be done through maintaining the program.
8.2 Types of instruction
A program is a set of instructions (steps) that a computer should follow to perform a
given task. The instructions should be written in a language (or can be translated to a
language) that can be understood by the computer. The language that is used to write
instructions is called a programming language. Depending on the function the instruction
performed, instructions are categorized as follows:
1/ Input/ output Instructions: These instructions perform interfacing ( communication)
b/n the user and the computer through the I/O peripherals Transfer data b/n peripherals
and memory, or between peripherals and accumulators.
2/ Arithmetic and Logic Instructions:- These instructions perform arithmetic operations
( addition, subtraction, multiplication and division) and logical comparison.
3/ Branch ( or control transfer) Instructions:- A branch instruction (also called a jump
instruction) alters the normal sequence of program execution and is used to create loops
that allow the same sequence of instructions to be executed many times. There are two
98
types of branch instructions, unconditional and conditional. An Unconditional branch
always causes the program to jump to the branch address. A conditional branch only if a
specified condition is met.
4/ Information Monument Instruction ( storage/ retrieval/:- This group of instructions
take on the task of moving information from one register ( or storage location) to another.
Every programming language has its own sets of instruction and it has its own way of
writing the instructions.
8.3. Types of programming languages
We have seen that a computer system consists of different layers. It is possible to
communicate with the computer by writing a program at the different layers but basically
there are three types of programming languages:- Machine, low-level and high- level.
Machine language:- There is the only language that the computer understands directly
zero. A machine language is a set of machine instructions which consists of zeros and
one‟s. a machine instruction contains two parts an operation code ( op code) and an
address. The OP code tells the microprocessor system what operation it should perform,
add, transfer, compare, or move data to output device, etc. the address identifies the
location ( memory, register) holding the required operands that is, the data to be operated
upon. The address part may contain one, two or more addresses that is , there may be one
( or single address, two( double) address, and three ( or triple) address instructions.
Low-level Languages:- In machine language we have seen that the OP code and the
address are represented as a binary sequence but it is difficult for the programmer to write
a big program using binary sequence and it is difficult to debug an error from such
program so instead of representing the OP code and the adders as a binary sequence we
can represent them in mnemonics ( terms). A low-level language is a programming
language which uses mnemonics to write in program Low-level languages are machine
dependent.
Ex: Assembly language
High-level language: We have seen that writing a program in low-level languages is
easier and simple compare to machine languages. But still low-level languages have their
own draw bakes, that is they are machine dependent. So we need another type of
99
languages which are not machine dependent and more flexible there languages are called
high-level languages third generation languages.
Advantages of high-level languages:-
Easier to learn and understand ( Look like English)
Require less time to write and easier to debugge errors.
Can be used on different machines with little modifications.
Ex:- Fortran, COBL, ALGOG 80, Basic, Scientific & engineering applications.
Fortran:- Formula in Business data processing application
COBL-:-Common business Oriented Language
ALGOL 80:- ( Algorithmic Oriented Language)
BASIC:- ( Beginners All-purpose symbolic Instruction code) simplest language
developed for solving numerical problem
Pascal, L, Ada, Modula-2:- Used in teaching programming language.
There are also other languages which are still simplest and easier then high-level
languages which we called then fourth generation languages. These languages are
application oriented languages.
Ex:- Visual basic,
8.4. Translation and Execution
The only language that the computer understands is the machine language. Therefore any
program that is written in either low-level or high level language must be translated to
machine code so that it could be processed by the computer.
A program written in high-level or low-level language is called source code program and,
the translated machine code is called the object code program. Programs that translate a
program written in high level language and low-level language to machine code program
are called translators.
There are three types of translators; assembler, interpreter, and compiler.
Assembler:- A program that translate in source program written in a how-level language
( assembly) to machine- code .
Interpreter:- A translator that accepts one line of a source program at a time, produces
the corresponding machine code instructions and execute them.
100
Compiler:-A program designed to translate a high-level language source program into a
machine code program. It translates the whole source program at once.
The translator not only translate the instructions into machine code but also it detects
whether the program fulfills the syntax of the programming language. A program passes
through different stages before it carries out its function. First the program will be
translate to object code( compilation time) , then it will be loaded to the memory and
finally it will be executed (run time) or carries out its function.
101
Chapter 9
System Development Life Cycle (SDLC)
A system is a group of integrated parts that have a common purpose of achieving some
objective(s).
- group of parts
- integrated parts
- common purpose of achieving some objective(s).
A computer based information system has a life cycle, just like a living organism or a
new product.
102
3. System analysis:
In system analysis, the existing information processing procedures are documented in
detail.
- Interviews
- document observation and
- physical work observation
- identifying strengths and drawbacks of the existing system
- producing a draft report
4. Design:- the analysis phase is concerned with what must be done, and the design
phase is concerned with how it will be done. The most challenging and creative
part of the life cycle is the design of a new system. One approach to this task is to
develop an ideal system relatively unconstrained by cost or technology; this ideal
system is then refined until it becomes feasible.
103
special programs to convert existing files into new ones or to create files from
manual records
6. Post–implementation and maintenance:
- Evaluation – is the system running
- Maintenance & enhancement – errors should be corrected and certain
aspects must be modified as operational experience is gained with it.
104
Chapter 10
Computer Virus
Parts of a Disk
On all PC fixed disks, the first physical sector is reserved for a short bootstrap program.
This sector is the master Boot (MBR). It also includes the partition table.
Partition Table
PC disks are often split in logical blocks known as partition. Information required to
access these partitions ,as well as a flag which indicates which partition should be used to
boot the system(the active partition) is stored in the Master Boot Record.
What is computer virus?
Virus
A virus is an independent program which reproduces itself. It may attach to other
programs; it may create copies of itself (see companion viruses). It may attach itself to
any executable code, including but not limited to boot sectors and /or partition sectors of
hard and/or floppy disks. It may damage, corrupt or destroy data, or degrade system
performance.
Types of viruses
Multi-Partite
105
A virus which able to infect both files and boot sectors is said to be multi-partite. Such
viruses are highly infectious.
A virus which infects the boot sector of a fixed or floppy disk. Any formatted disk (even
one that is blank, or only contains text data, for example ) may contain a boot sector
virus. An attempt to boot from a diskette infected with a boot sector virus will cause the
virus to become active in memory. This type of virus will place a copy of itself on the
Master Boot Record(MBR) or the boot sector of the hard drive. Every time you boot
your system from that point on , you will have the virus active in memory. These are the
most common viruses. Any attempt to disinfect these viruses while a virus is active in
memory will be defeated since it will re- write itself to the disk as soon as you remove it.
Additionally, many of these are stealth viruses. For safety‟s sake, you should always
attempt to disinfect these viruses after a cold boot to a write –protected diskette.
Circular infection
A type of infection that occurs when 2 viruses infect the boot sector of a disk, rendering
the disk unbootable. Removing one virus will generally causes a re-infection with the
other virus.
Companion Virus
A virus which infects executable files by creating a „companion‟ file with the same name
but an .COM extension. Since DOS executes .COM files, followed by .EXE files, and
finally .BAT files, the virus loads before the executable file.
Cross-Linked Files
106
Cross-linking is a common phenomena rarely associated with viruses. It occurs when two
files appear to share the same clusters on the disk.
Dropper
A dropper is a program containing a virus which has been compressed with PKLite, Diet,
LZExe, etc. it has been designed to deposit the virus onto a hard disk, floppy disk, a file,
or into memory. The children of this process are not droppers.
Encryption
Among the most difficult to detect, encrypted viruses use a brief encryption loop at the
start of the program to make the rest of the program unintelligible. This means that
scanners relaying on signature files have only a few bytes to look for. The encryption key
also changes each time a polymorphic virus replicates.
False Positive
A false positive occurs when a scanner identifies a file as infected when in fact it is not.
In addition to redirection for the boot information, these viruses attack .COM and .EXE
(executable files) files when opened or copied and hides the file size changes from the
DIR command. The major problem arises when an attempt is made to use CHKDSK/F
and there appears to be a difference in the reported file size and the apparent size.
CHKDSK assumes this is the result of some cross-linked files and attempts to repair the
damage. The result is the destruction of the files involved. The FRODO or 4096 virus is
famous for this kind of damage.
See also Stealth Virus and Full Stealth Virus.
107
Full Stealth Virus
In this case, all normal calls to file locations are cached while the virus subtracts its own
length so that it appears clean.
Heuristics
A rule-based method of identifying new viruses. This method of scanning does not rely
on specific virus signatures. The advantage of the heuristic scan is that it is not fooled by
a new variant of an existing virus. However, it might occasionally report suspicious code
in normal programs. For example, the scanning of a program may generate the message:
F-PROT will issue a stronger warning based on the likelihood of a program really
containing a virus.
Integrity Checker
A program which checks for changes to files. Integrity checkers, when used correctly,
can provide an excellent second line of defense against new viruses or variants.
In the Wild
Viruses found “In the Wild” are viruses which are known to be spreading, as opposed to
viruses which are not currently spreading, but are confined “in the zoo.”
Joke Programs
F-PROT detects the presence of several well-known joke programs which can interrupt
the normal operation of a PC. While joke programs are generally not harmful in any way,
their side effects are often mistaken for those of a virus.
108
Macro Virus
A macro virus is a virus written in one of the many macro languages. The macro viruses
spread via infected files, which can be documents, spreadsheets, databases, or any
computer program which allows use of a macro language. At present these viruses can
infect Microsoft Word and Lotus Ami Pro documents. See also Macro Virus information
section.
Polymorphism
Stealth Virus
These viruses actively hide themselves while running. The first common virus, the
BRAIN (discovered in the wide in 1986), was a stealth virus. It infects the boot sector of
a floppy diskette and any attempts to read the boot sector with BRAIN active would be
redirected to a copy of the original boot sector someplace else on the diskette.
A Trojan (or Trojan Horse) is a program which carries out an unauthorized function
while hidden inside an authorized program. It is designed to do something other than
what it claims to, and frequently is destructive in its actions.
109
Virus Simulator
A virus simulator is a program which creates files that “look like” viruses. Such files are
questionable for testing purposes because they are not really infected. F-PROT will not to
be fooled by a simulator.
Virus Variant
Worm
A worm is a program which reproduces by copying itself over and over, system to
system. Worms are self-contained and g
110