Chapter 2 Computer Hardware 4
Chapter 2 Computer Hardware 4
1 Introduction
Computer Hardware
They consist of the CPU, Memory, motherboard, input devices, output devices,
connection buses/cable etc
The term hardware distinguishes the tangible aspects of a computing device from software, which
consists of written instructions that tell physical components what to do.
Computer hardware can be categorized as having either internal or external components. Internal
com- ponents include items such as the motherboard, central processing unit (CPU), random
access memory
Hardware 1
(RAM), hard drive, optical drive, heat sink, power supply, transistors, chips, graphics
processing unit (GPU), network interface card (NIC) and Universal Serial Bus (USB) ports.
Here are some common individual computer hardware components that you’ll often find inside
a mod- ern computer. These parts are almost always found inside the computer’s case, so you won’t
see them unless you open the computer:
•Motherboard
•Power Supply
•Video Card
External components, also called peripheral components, are those items that are often connected to
the computer in order to control either its input or output. Common input components include a
mouse, key- board, microphone, camera, touchpad, stylus, joystick, scanner, USB flash drive or
memory card. Monitors, printers, speakers, headphones and earphones/earbuds are all examples of
output computer hardware com- ponents. All these hardware devices are designed to either provide
instructions to the software or render results from its execution.
Hardware 2
1.1 Relationship between hardware and software
•Hardware and software are mutually dependent on each other. Both of them must work
together to make a computer produce a useful output.
•Hardware without a set of programs to operate upon cannot be utilized and is useless.
•To get a particular job done on the computer, relevant software should be loaded into the
hardware.
•If the hardware is the ’heart’ of a computer system, then the software is its ’soul’. Both are
comple- mentary to each other.
A computer performs five major operations or functions irrespective of its size and make. These are
3. Processing unit (Central Processing Unit (CPU)) - The task of performing operations like
arithmetic and logical operations is called processing. The Central Processing Unit (CPU)
takes data and in- structions from the storage unit and makes all sorts of calculations based
on the instructions given and the type of data provided. It is then sent back to the storage
unit. CPU itself has the following three components
Hardware 3
(a) Arithmetic and Logic Unit (ALU)- All calculations and comparisons, based on the
instructions provided, are carried out within the ALU. It performs arithmetic functions like
addition, subtrac- tion, multiplication, division and also logical operations like greater
than, less than and equal to etc.
Hardware 4
(b) Registers - High speed small memory cells in the CPU used to hold data and
instructions being processed
(c) Control Unit (ALU) - Controlling of all operations like input, processing and output are
performed by control unit. It takes care of step by step processing of all operations
inside the computer.
4. Output unit - This unit is responsible for presenting the processed data/information to the
user
These devices are used to enter information and instructions into a computer for storage or
processing and to deliver the processed data to a user. Input/Output devices are required for
users to communicate with the computer. In simple terms, input devices bring information INTO
the computer and output devices bring information OUT of a computer system. These
input/output devices are also known as peripherals since they surround the CPU and memory of a
computer system.
An input device is any device that provides input to a computer. There are many input
devices, but the two most common ones are a keyboard and mouse. Every key you press on the
keyboard and every movement or click you make with the mouse sends a specific input signal to
the computer.
•Keyboard: The keyboard is very much like a standard typewriter keyboard with a few
additional keys. The basic QWERTY layout of characters is maintained to make it easy to
use the system. The additional keys are included to perform certain special functions.
These are known as function keys that vary in number from keyboard to keyboard.
•Mouse: A device that controls the movement of the cursor or pointer on a display screen.
A mouse is a small object you can roll along a hard and flat surface. Its name is derived from
its shape, which looks a bit like a mouse. As you move the mouse, the pointer on the display
screen moves in the same direction.
Hardware 5
•Trackball: A trackball is an input device used to enter motion data into computers or other
electronic devices. It serves the same purpose as a mouse, but is designed with a moveable
ball on the top, which can be rolled in any direction.
•Touchpad: A touch pad is a device for pointing (controlling input positioning) on a computer
display screen. It is an alternative to the mouse. Originally incorporated in laptop
computers, touch pads are also being made for use with desktop computers. A touch pad
works by sensing the user’s finger movement and downward pressure.
•Touch Screen: It allows the user to operate/make selections by simply touching the
display screen. A display screen that is sensitive to the touch of a finger or stylus. Widely
used on ATM machines, retail point-of-sale terminals, car navigation systems, medical
monitors and industrial control panels.
Hardware 6
•Light Pen: Light pen is an input device that utilizes a light-sensitive detector to select
objects on a display screen.
•Magnetic ink character recognition (MICR): MICR can identify character printed with
a special ink that contains particles of magnetic material. This device particularly finds
applications in banking industry.
•Optical mark recognition (OMR): Optical mark recognition, also called mark sense
reader is a technology where an OMR device senses the presence or absence of a mark, such
as pencil mark. OMR is widely used in tests such as aptitude test.
Hardware 7
•Bar code reader: Bar-code readers are photoelectric scanners that read the bar codes or
vertical zebra strips marks, printed on product containers. These devices are generally used
in super markets,
bookshops etc.
•Scanner: Scanner is an input device that can read text or illustration printed on paper and
translates the information into a form that the computer can use. A scanner works by
digitizing an image.
•Printer: Printers are used to produce paper (commonly known as hardcopy) output. Based
on the technology used, they can be classified as Impact or Non-impact printers. Impact
Hardware 8
printers use the
Hardware 9
typewriting printing mechanism wherein a hammer strikes the paper through a ribbon in order
to produce output. Dot-matrix and Character printers fall under this category. Non-impact
printers do not touch the paper while printing. They use chemical, heat or electrical signals to
etch the symbols on paper. Inkjet, Deskjet, Laser, Thermal printers fall under this
category of printers.
•Plotter: Plotters are used to print graphical output on paper. It interprets computer
commands and makes line drawings on paper using multicoloured automated pens. It is
capable of producing graphs, drawings, charts, maps etc.
•Facsimile (FAX): Facsimile machine, a device that can send or receive pictures and text
over a telephone line. Fax machines work by digitizing an image.
the CPU is the brains of the computer where most calculations take place. In terms of computing
power, the CPU is the most important element of a computer system.
2. Instruction Decode (ID) - The decode cycle is used for interpreting the instruction
that was fetched in the Fetch Cycle. The operands are retrieved from the addresses
if the need be.
3. Data Fetch (DF) - To load an instruction or piece of data from memory into a CPU’s
resister.
Hardware 10
is decoded by the control unit. It then passes the decoded information as a sequence of
control signals to the relevant functional units of the CPU to perform the actions
required by the instruction such as reading values from registers, passing them to the
Arithmetic logic unit (ALU) to add them together and writing the result back to a
register. A condition signal is sent back to the control unit by the ALU if it is
involved.
5. Result Return (RR) - The result generated by the operation is stored in the main
memory, or sent to an output device. Based on the condition feedback from the
ALU, the PC is either incremented to address the next instruction or updated to a
different address where the next instruction will be fetched. The cycle is then
repeated.
1.2.4 Computer Memory
Let’s start by reviewing how quantities of memory/storage are measured.
A bit (which is contraction for ”binary digit”) is the smallest unit of data, a single 0 or 1. Recall that
computers represent data (of all kinds, including numbers, characters, images, and audio) using
0’s and 1’s.
Memory cell - A memory cell is the smallest unit of information storage and holds a single 0
or 1. Memory cells are often grouped together to form words. The location of each cell in the
memory is specified by its address, which is called a physical address to distinguish it from the
logical address of an operand generated by the computer.
Capacity - A memory’s capacity is expressed as the number of bits or bytes that it can hold.
Density The density of a memory system is a measure of how much data can be stored per
unit area or per unit volume; that is density = capacity/size.
Access time A memory component’s most important parameter is its access time, which is
the time taken to read data from a given memory location, measured from the start of a read
cycle. Access time is made up of two parts: the time taken to locate the required memory cell
within the memory array, and the time taken for the data to become available from the memory cell.
Strictly speaking, we should refer to read cycle access time and write cycle access time. Since
many semiconductor memories have almost identical read and write access times, we regard
access time as the read or write access time. This is not true of all forms of memory, because
some devices have quite different read and write access times. Some memories are also specified
in terms of cycle time, which is the time that must elapse between two successive read or write
accesses. Access time and cycle times are often identical. However this statement is not true for
semiconductor dynamic memories and flash EPROMs.
Hardware 11
Random access When memory is organized so that the access time of any cell within it is
constant and is independent of the actual location of the cell, the memory is said to be
random access memory
Hardware 12
(RAM). That is, the access time of random access memory doesn’t depend where the data
being accessed is located. This means that the CPU does not have to worry about the time taken
to read a word from memory because all read cycles have the same duration.
If a memory is random access for the purpose of read cycles, it is invariably random access for the
purpose of write cycles. It is unfortunate that the term RAM is often employed to describe
read/write memory where data may be read from the memory or written into it (as opposed to
read-only memory). This usage is incorrect, because the term random access indicates only the
property of constant access time and has nothing to do with the memory’s ability to modify (i.e.,
write) its data. Another term for random access is immediate access. The dialed telephone system
is a good example of random access memory in everyday life. The time taken to connect with
(access) any subscriber is constant and independent of their physical location.
Serial access In a serial access memory, the time taken to access data is dependent on the
physical location of the data within the memory and can vary over a wide range for any given
system. Examples of serial access memories are magnetic tape transports, disk drives, CD drives,
shift registers, and magnetic bubble memories. Serial access is also referred to as sequential
access. It’s easy to see why serial access memories have variable access times. If data is
written on a magnetic tape, the time taken to read the data is the time taken for the piece of
tape containing the data to move to the read head. This data might be 1 in or 2400 ft from the
beginning of the tape.
Bandwidth The bandwidth of a memory system indicates the speed at which data can be
transferred between the memory and the host computer and is measured in bytes/second.
Bandwidth is determined by the access time of the memory, the type of data path between the
memory and the CPU, and the interface between the memory and CPU. For example, a hard
disk might have a bandwidth of 40 Mbyte/s; that is, 40 Mbytes can be transferred between the
disk and CPU in a second.
Latency Bandwidth indicates how fast you can transfer data once you have the data to
transfer. La- tency refers to the delay between beginning a memory access and the start of the
transfer. When speaking of disk drives, latency refers to the time taken for the disk to rotate until
the desired data is under the read/write head. When speaking of buses, latency refers to the time
taken to get control of a bus before a data transfer can take place.
Volatile memory Volatile memory loses its stored data when the source of power is removed.
Most semi- conductor memories in which data is stored as a charge on a capacitor or as the state
of a transistor (on or off) in a bistable circuit are volatile. Some semiconductor devices such as
EPROM and flash memory are non-volatile and retain data when the power is off. Memories based
on magnetism are generally non-volatile because their magnetic state doesn’t depend on a
continuous supply of power.
Read-only memory (ROM) The contents of a read-only memory (ROM) can be read but not
modified (under normal operating conditions). True read-only memories are, by definition, non-
volatile. Read-only memory is frequently used to hold operating systems and other system
software in small microprocessor systems (e.g., palm-top personal organizers).
Static memory Once data has been written into a static memory cell, the data remains there
until it is either altered by over-writing it with new data, or by removing the source of power if the
memory is volatile.
Dynamic memory Dynamic memories (DRAM) store data in the form of an electronic
charge on the inter-electrode capacitance of a field effect transistor. Because this capacitor is not
perfect, the charge gradually leaks away, discharging the capacitor and losing the data. Dynamic
Hardware 13
memories require additional circuits to restore the charge on the capacitors periodically (every
2—16 ms) in an operation known as
Hardware 14
memory refreshing. DRAMs are much cheaper than static memories of the same capacity.
•Registers: These are memory cells (typically four or eight bytes in size) that are part of the
processor itself, so that operations (e.g. addition, comparison, etc.) can be performed directly
upon data stored therein (and usually within a single clock cycle, which is less than a billionth
of a second!). Indeed, only data items (including instructions) that are being held in a register
can be operated upon by the processor. Hence, any data item in RAM that is to be used for
some purpose first must be transferred into a register. In order to keep the electronic circuitry
of the processor at a reasonable level of complexity, the number of registers is quite small,
typically no more than a few dozen.
•Cache: This is a block of very high-speed (and expensive) memory cells (typically four bytes
in length) used for storing copies of data items also being held in RAM that have been
accessed very recently or are anticipated to be accessed in the very near future. Due to its
high cost, cache capacity is typically limited to the neighbourhood of 512KB (one-half MB) to
4MB. Some processors have multiple levels of cache (usually referred to as L1 and L2, for
example), with L1 being faster (access within a few clock cycles) but having lower capacity
(e.g., tens of KB) than L2 (access to which requires tens of cycles).
•Random Access Memory (RAM): This is a block of fairly high-speed memory cells that
are used for storing (portions of) currently-executing programs and data that those
programs are using.
The term ”random” is meant to suggest that the time required to access any particular
memory location in RAM is independent of which memory location was accessed most
recently. (This is in contrast to accessing the ”data” on a VHS or audio cassette tape, which
are ”sequential” (rather than ”random”) storage devices. Suppose, for example, that a VHS
tape is fully rewound; then to get to the fifth hour of video stored on that tape, you must fast
forward past the first four hours. On the other hand, if the tape were already at the beginning
of the fourth hour, you could get to the fifth hour by fast forwarding past only one hour of
video.
Regarding the interplay between cache and RAM: Roughly speaking, whenever the CPU
needs to fetch the data occupying some particular memory cell in RAM, first it looks in
cache to see if a copy is already there. If so, it accesses that copy in a fraction of the time
that would have been required to access the corresponding cell in RAM. If not, it accesses
the desired cell of RAM; also, anticipating that that same cell of RAM will need to be
accessed again in the near future, the CPU copies that cell’s contents (as well as that of a
block of neighbouring cells) into cache (replacing some block of data items that hasn’t been
accessed recently).
The introduction of cache is a relatively new development, motivated by the fact that (as
processor and memory technology has advanced over the years) the ratio between the time
needed to transfer data between RAM and a register and the time needed to perform an
operation on data (that is necessarily already in a register) has been steadily growing, to the
point where, without cache, the CPU would be spending the vast majority of its time waiting
for data to be transferred between RAM and registers. This phenomenon is sometimes
referred to as the processor-memory bottleneck.
The term transitory can be used to describe the kinds of main memory listed so far.
This term is apt because their intended purpose is not to store anything for long, but rather to
Hardware 15
provide fast ac- cess to data (and instructions) currently being used (i.e., related to
applications currently running and whatever data they are using). Because there is no need to
store data in main memory permanently (see exception below), and because it is cheaper to
do so, registers, cache, and RAM are designed to
Hardware 16
be volatile, meaning that, absent a constant application of electrical power, they lose their
contents relatively quickly.
•Read-only Memory (ROM): A small block of (non-volatile) memory having as one of its
purposes to store instructions that are executed whenever the computer is turned on,
commencing the so-called ”boot-strapping” process by which (crucial components of) the
operating system is loaded into RAM, thereby allowing the computer to begin functioning.
(From this description, it should be fairly clear why it is vital for ROM to be non-volatile.)
Secondary Memory
The purpose of secondary storage is to store data and programs on a long-term basis. (Hence,
all forms of secondary storage are non-volatile, meaning that they retain the data stored on them
(for a long period of time) without the need for electrical power.) As data (or a program) is
needed in RAM (e.g., when a program is called upon to be executed, such as when the user double
clicks upon an icon representing that program), it is copied from secondary storage into RAM,
where it can be accessed quickly.
•Solid-State: For example, flash memory sticks; these usually are attached to a computer via
a USB port and have a capacity in the hundreds of MB or a few GB’s. They are highly
mobile and have largely supplanted floppy disks in recent times. This kind of storage is
widely used in devices such as PDA’s and digital cameras.
•Magnetic Disk: These are disks on which data is recorded on a set of concentric rings
(or ”tracks”) using properties of magnetism.
– Hard disk: high storage capacity (in early 2008, typically in the range of 80 to 320 GB)
and much cheaper than RAM.
– Removable/portable disk.
•Optical Disc: These are discs on which data is represented by a spiraling track of ”pits and
lands” (or valleys and bumps, if you prefer). A laser beam is used to ”read” the data on
the surface.
– Computer Disk Read Only Memory (CD-ROM): ”Read Only” (used for distribution of
commer- cial software, for example) Standard storage capacity is 640MB.
– Computer Disk Read CD-R (or CD-WORM): ”Write Once, Read Many” times -WORM
stands for Write-Once Read Many times
– Computer Disk Re-Writeable (CD-RW): rewritable multiple times (but you can’t really
delete a file without deleting all of them!)
– Digital Versatile Disk (DVD): similar to CD, but with significantly larger storage
capacity
•Magnetic Tape: usually used for making backup copies of disk (so that if the disk fails, a
recent copy of its contents can be recovered and written onto a new replacement disk) or
for archival storage. Tapes that are kept offline (meaning that they sit on a shelf and
are ”mounted” onto a tape drive (by a human or a robotic device) only when needed) are
sometimes put into the category of tertiary, as opposed to secondary, storage. Tape drives are
what you see spinning in the background in numerous scenes in movies and TV shows
depicting a large computer.
Types of ROM
Hardware 17
Virtually all of the digital technology we use today contains some kind of memory, and computers
es- pecially contain many different types. There are five basic types of read-only memory (ROM),
and data stored on these cannot be lost or changed without a special operation:
Hardware 18
•ROM is a basic read-only memory chip.
•PROM is a programmable read-only memory chip. The chip comes ”blank” and can be
programmed only once by a user.
•EPROM is erasable programmable read-only memory. These chips can be erased and
rewritten a number of times. They are removed from the computer and erased with a special
tool that emits ultraviolet light.
•Flash memory is a type of EEPROM that uses in-circuit wiring to erase the chip. Flash
memory is much faster than EEPROM.
EPROM chips differ from ROM chips in that they can be rewritten. Much like other ROM chips,
they have a grid that communicates binary data when read by an electrical charge. However,
while ROM can only be programmed once and is from then on unalterable, EPROM is erasable
and can be reused. The erasing procedure entails removing the EPROM chip from the computer
and applying ultraviolet light with a special tool. Once the chip is erased, it can be reprogrammed
any number of times. The EPROM grid is different than ROM grids because it has two transistors
at each intersection; one is called the floating gate, and the other is called the control gate. When a
charge is sent, the floating gate acts like an electron gun, creating negatively charged electrons
where a cell sensor monitors their charge. The data value is determined by the amount of current
passing through the gate: More than 50 percent reads as a one, and less than 50 percent reads as
a zero
Virtual Memory
The purpose of RAM is to store the programs that are currently running and the data that
those pro- grams are processing, so that instructions and data needed by the CPU can be copied
into registers (where the CPU can actually make use of them) quickly.
However, it often happens that RAM is not large enough to fit all running programs and their data.
To alleviate this situation, many modern operating systems implement virtual memory, which
basically means that some secondary storage (typically some segment of a hard disk) is used for
holding portions of pro- grams/data that, logically speaking, are considered to be in RAM.
Whenever the CPU attempts to fetch an instruction or data item from virtual memory, first it must
be confirmed that that instruction or data item is actually in RAM. If it is, access proceeds
normally. If not, whatever ”page” of virtual memory holds the desired item must first be ”swapped”
into RAM (from the disk), replacing some page of data that was already there, which itself gets
written to the disk. The effect of virtual memory, then, is to, in a sense, make RAM seem much
larger than it actually is.
The relationship between RAM and virtual memory is analogous to that between cache and RAM.
Among the benefits of virtual memory is that it gives programmers the freedom to develop
programs without worrying too much about how much memory a program (or its data) will occupy.
From the user’s point of view, it makes it possible to run lots of programs simultaneously
without having to worry about the machine ”crashing” due to a lack of space in RAM.
Sometimes, when virtual memory is being stretched to its limit, page swapping becomes so frequent
that sys- tem performance degrades very badly. (Note that swapping one page for another is a very
time-consuming operation, which, in the context of an electronic digital computer, can mean a
duration of as little as a hundredth or thousandth of a second.) This is referred to as thrashing.
Hardware 19
Of course, the larger RAM’s ca- pacity, the less will be the need for swapping and hence the less
likely that thrashing will occur. If bouts of
Hardware 20
thrashing are adversely affecting you, don’t buy a faster CPU. Rather, install more RAM.
RAM ROM
Stores data and instructions during and Program stored by manufacturer
after
processing
Volatile (Store information temporarily) Non-volatile (Stores information perma-
nently)
Fast Slow
Uses more power Uses less power
Read and write memory Read Only memory
1.3 Buses
Bus
A set of physical connections (cables, printed circuits, etc.) which can be shared by multiple
hardware components in order to communicate with one another.
The purpose of buses is to reduce the number of ”pathways” needed for communication
between the components, by carrying out all communications over a single data channel. This is
why the metaphor of a ”data highway” is sometimes used.
Hardware 21
to refer to the number of bits that
Hardware 22
Figure 3: Bus Connecting Computer Components
Additionally, the bus speed is also defined by its frequency (expressed in Hertz), the number of data
packets sent or received per second. Each time that data is sent or received is called a cycle.
•The Address bus (sometimes called the memory bus) transports memory addresses which
the pro- cessor wants to access in order to read or write data. It is a unidirectional bus.
•The Data bus transfers instructions coming from or going to the processor. It is a
bidirectional bus.
•The Control bus (or command bus) transports orders and synchronization signals coming
from the control unit and travelling to all other hardware components. It is a bidirectional bus,
as it also transmits response signals from the hardware.
Hardware 23