G3 Computing Textbook Chapter 01
G3 Computing Textbook Chapter 01
01 Computer Architecture
1
2
3
1.1 Introduction to Computer Architecture
ER MS
KEY T
Computer
A device that receives and processes data
according to a set of instructions and
produces the processed data.
Computer architecture
A description of how a computer is
designed and built to function, including
how its various parts are designed,
organised and connected.
U
DID YO
?
KN OW
There are many ways to build a computer. While most modern computers
run on electricity, early computers did not use electricity at all. Instead,
they relied on mechanisms such as cranks, gears, pulleys and levers. These
mechanical computers used a completely different computer architecture
from the computers we are familiar with today.
For example, Figure 1.1 shows a toy called the Dig-Comp II that uses a set
of switches to represent data. These switches are connected to ramps. As
marbles roll down the ramp, they trigger the switches in different ways.
Because of this, the toy is able to perform computations such as addition,
functioning as a mechanical computer that works without electricity.
Figure 1.1 Digi-Comp II
4
1.2 Units of Data
LEARNING OUTCOMES
1.1.1 Perform calculations using bits, bytes, kilobytes, kibibytes, megabytes, mebibytes,
gigabytes, gibibytes, terabytes, tebibytes, petabytes and pebibytes.
kilobyte kB 1,000
5
U
DID YO
?
KNO W
In the past, units of data such as “kilobyte”, “megabyte” and “gigabyte” were
based on powers of 1,024 (or 210) instead of the standard powers of 1,000 used in
the International System of Units (SI). However, since 1998, multiple standards
organisations have agreed that SI prefixes (i.e., “kilo”, “mega”, “giga”, etc.) should follow their standard
meanings while new binary prefixes (i.e., “kibi”, “mebi”, “gibi”, etc.) would be used to represent powers of
1,024.
Despite this change, you may still encounter the use of “kilobyte” and “megabyte” to represent 1,024 bytes
and 1,0242 bytes respectively, instead of the correct units “kibibyte” and “mebibyte”.
QUICK
E C K 1.2
CH
1. 1 kilobyte is the same size as 1,000 bytes. True or false?
2. Arrange the following units in increasing size: bit, byte, gibibyte, gigabyte, kibibyte, kilobyte
LEARNING OUTCOMES
1.1.2 Describe the function of key components of a computer system: its processor, main
memory and secondary storage.
1.1.3 Describe the function of data and address buses in reading from and writing to
memory.
1.1.4 Describe different input/output interfaces (USB, HDMI and PCI Express) in terms of
typical applications, connectors and speed.
1.1.5 Describe the use of magnetic, optical and solid-state media for secondary storage in
terms of durability, portability, typical capacities, cost and speed.
6
Most computer parts can be organised into the following
roles in Table 1.2. Figure 1.2 shows where the parts
performing these roles may be found inside the case of
a desktop computer.
U
DID YO
?
KNOW
f/g
Instead of having separate
parts, the key components of b
a computer in mobile devices
such as smartphones and
laptops are combined into a c
single part called a System d
on a Chip (SoC). This has the e
benefits of smaller size, lower
a
power consumption and,
often, improved performance.
However, SoCs are also
more complex and require
specialised expertise to
design and manufacture.
Role Description
(b) Memory Stores data and instructions temporarily for immediate use by
the processor
(c) Secondary storage Stores large amounts of data that will not be lost when the
power supply is interrupted
(d) Data bus Transports data between memory and processor; bi-directional
7
1.3.1 Processor
Central processing unit (or processor) Often, a processor’s speed is described by the number
The part of the computer that processes of instructions that the processor can perform in one
data and follows instructions. second. For instance, a 1 MHz (megahertz) processor
can perform one million instructions per second while
Execute a 1 GHz (gigahertz) processor can perform one billion
To follow or perform an instruction. instructions per second. In general, the larger the
number and unit, the faster and more powerful the
Software processor.
A set of instructions to perform specific
tasks on a computer. There are also “multi-core” processors that contain
multiple processing units inside a single package.
For instance, a “dual-core” package has two such
processing units while a “quad-core” package has
four. These “multi-core” processors can perform more
than one instruction at the same time, and thus are
more powerful than “single-core” processors.
U
DID YO
?
KN OW
Many computers also include a specialised computer
part called a Graphics Processing Unit (GPU) that is
more efficient at performing the calculations needed
to produce images than a CPU. By relieving the CPU
of tasks related to 2D and 3D graphics, GPUs help to
improve the overall performance of a system.
8
1.3.2 Main Memory
Physically, memory exists in different forms, but in general, it consists of many switches arranged in a fixed
order. Each switch can store one bit of data based on whether it is ON or OFF (i.e., ON = 1, OFF = 0). Since a
byte consists of eight bits, we usually look at eight consecutive switches at a time, as shown in Figure 1.5.
In Figure 1.5, big physical switches are used to represent memory, but in most computers, memory is made
up of very small electronic switches that take up much less space.
Usually, the position of each byte is represented by a number called an address. This is a number that
allows a computer to quickly find those switches again if it needs to read or change the data that is stored.
This is similar to how a unit number is used to identify the location of each residence in an HDB block.
ERMS
KEY T
Address
A number that is used to locate a byte in
memory.
Volatile
Lost when the power supply is interrupted.
Figure 1.5 Memory as a collection of switches in a fixed order
9
1.3.3 Secondary Storage
ERMS
KEY T
Secondary storage is a way of storing large
amounts of data that will not be lost when the
power supply is interrupted. Compared to RAM, Secondary storage
secondary storage is usually cheaper and able to A way of storing large amounts of data
store much more data. It is also non-volatile, so the that will not be lost when the power
data that is stored remains there even without a supply is interrupted.
power supply. This makes secondary storage ideal
for physically transporting data from one computer Hard disk (or hard drive)
to another. On the other hand, secondary storage Secondary storage where data is stored
is usually much slower in speed compared to RAM. on rigid rotating disks coated with a
magnetic material.
The word “storage” usually refers to secondary
storage.
There are many types of storage media available. When deciding on the best type of storage media to use,
these factors should be considered:
10
1.3.3.2 Types of Storage Media
Table 1.3 summarises three main types of storage media in terms of durability, portability, typical capacities,
cost and speed.
Portability Heavier and bulkier Portable due to small Portable due to small
than optical and solid- size and light weight size and light weight
state media
Speed Slower than solid-state Slower than solid-state Faster than magnetic
media media and optical media
11
1.3.4 Data and Address Buses
Conductive lines
(including data and address buses)
ER MS
KEY T Two important buses that transport data between
the processor and memory parts of a computer are
Bi-directional the data bus and the address bus:
Able to work in two directions, to and fro.
1. The data bus transports data that is going to be
Data bus processed to the CPU, and transports data that has
A bus that is used to transport data between already been processed from the CPU. The data bus
memory and the processor. is bi-directional because data can be sent in both
directions between the processor and memory.
Address bus
A bus that is used to specify memory address 2. The address bus specifies memory address
information. information. When the processor reads from or
writes to the memory (RAM), the relevant address
Uni-directional information is provided on the address bus. The
Able to work in one direction only. address bus is uni-directional because address
information is always sent in one direction only,
that is, from the processor to the memory.
For instance, to read data from the memory, the processor requests the data, and the address bus transports
the requested data’s address to the RAM. A copy of the requested data is then sent from the RAM back to
the processor via the data bus. This is illustrated in Figure 1.9, which uses bits for data and simple numbers
for addresses.
12
0 01001011
Data Bus 1 10100101
01100101 2 01100101
3 10110010
4 01100100
2
5 01110101
6 11001100
and so on
...
Figure 1.9 How the data bus and address bus are used to read from memory
When writing data to the memory, the processor uses both the data bus and address bus at the same
time to transport the data for writing as well as the destination address to the RAM. The RAM then sets the
switches at the destination address according to the data received via the data bus, as illustrated in Figure
1.10.
0 01001011 0 01001011
1 10100101 1 10100101
11111111 2 01100101 2 01100101
Data Bus 3 10110010 3 10110010
4 01100100 4 11111111
4
5 01110101 5 01110101
Address Bus
6 11001100 6 11001100
and so on and so on
... ...
Figure 1.10 How the data bus and address bus are used to write to memory
As shown by the arrows in Figure 1.9 and Figure 1.10, while the address bus is always used to transport
information from the processor to the memory, the data bus can transport information in either direction.
In computer architecture, input refers to data or instructions that the computer receives for processing
while output refers to any intermediate or final results produced by the computer in the form of processed
data. Examples of input are words entered using a keyboard, pictures taken by a digital camera, and
movement instructions entered using a mouse. Examples of output are images displayed on a screen,
sounds played on a speaker and even sculptures printed using a 3D printer.
13
A computer usually has multiple input and output devices connected to it, as seen in Figure 1.11.
ER MS
KEY T
Input (computer architecture)
Data or instructions that the computer
receives for processing
Hardware
Physical components of a computer
Input device
A hardware device that allows users
to enter data and instructions into a
computer
Output device
A hardware device used to display, project
or print processed data from a computer
The method by which a computer connects to an input or output device is called an input/output interface.
Different input/output interfaces have varied uses, physical connectors and maximum data transmission
speeds as new versions of each interface are introduced over time. Table 1.4 summarises this information
for three common input/output interfaces:
Universal For powering and/ USB Type A USB Micro USB 2.0: 480 Mbit/s
Serial Bus or communicating USB 3.2: 20 Gbit/s
(USB) with external devices USB4: 80 Gbit/s
(e.g., printers, mice,
keyboards)
USB Type B USB Type C
USB Mini
14
Interface Typical Applications Connectors Maximum Speed
HDMI Mini
HDMI Micro
15
QUICK
C K 1. 23
CHE
1. Decide if each of the following statements on memory and storage are true or false.
a) Both memory and storage may contain data.
b) The contents of memory are retained when a computer restarts.
c) The contents of storage are retained when a computer restarts.
d) The typical cost per GB is cheaper for memory than for storage.
e) The typical capacity is higher for memory than for storage.
2. For each of the following situations, suggest an appropriate secondary storage medium that should be
used and give a reason for your choice:
a) Storing terabytes of video files for backup
b) Keeping an emergency copy of some important files in your wallet
The processor then executes an instruction to write the 8 bits 11111111 to address 3.
a) To execute the instruction, describe what information must be sent on the address bus and in what
direction.
b) Show the resulting first 4 bytes of memory after the instruction is executed.
4. Memory addresses can also be read from or written to memory as data. True or false?
5. Which of the three I/O interfaces (USB, HDMI and PCI Express) are suitable for directly connecting:
a) a wireless network adapter? b) an internal sound card?
c) a pair of audio speakers? d) a microphone?
W
REVIE
E STI ON
Q U
1. Describe the function of each of the following components:
a) Processor b) Main memory c) Secondary storage
2. Calculate the number of bits (not bytes) in the following amounts of data:
a) 8 TB b) 0.125 MB c) 0.125 MiB
16
ANSWER
4. Note that the answers below are just the answers for Q3 multiplied by 8 because 1 byte is the same as 8 bits.
a) 2,026 kB = 2,026 × (1,000 × 8 bits) = 16,208,000 bits
b) 19 GiB = 19 × (1,0243 × 8 bits) = 163,208,757,248 bits
c) 65 MB = 65 × (1,0002 × 8 bits) = 520,000,000 bits
3. Answers as follows:
a) The address 3 must be sent on the address bus. It is sent from the processor to memory.
b) Only the contents at address 3 is changed:
Address Contents
0 00000000
1 11110000
2 00110011
3 11111111
4. True. Memory addresses are just numbers so they can also be treated as data.
17
ANSWER
18