Chapter 2
Chapter 2
What is a computer?
A computer can be described as an electronic device, which accepts or collects data, processes them
according to the given instructions and produces the desired output.
Computer has become an essential device in our lives. Some of these features of a computer can be
described as follows;
2.1 Elicits the significant changes occurred in the computers from generation with more
emphasis on the evolution of processors.
History of Computing
(Adding Machine )
(1674)
Abacus
1
A French Scientist named Joseph Jacquard invented a mechanical loom using Punch Card System to
ease weaving cloth in 1801. Joseph Jacquard was able to make various patterns on cloths by using the
cards with punch holes.
An Englishman called Charles Babbage designed the first model required for a mechanical computer in
1822. It was called the ‘Difference Engine’
2
3
Classification of computers
There are several ways of classifying coputers
(i). According to size
(ii). According to technology used
(iii). According to purpose of use
4
(iii) Mini Computers
These are slower, less powerful and less expensive than Mainframe computers and are also called common
purpose computers. These are easy to use. A few users get connected to the central computer here through
a few terminals to share data and information. Some banking systems use mini computers.
5
Classification according to technology
Computers can be classified according to the technology used. These are,
(I) Analog Computers
These computers use analog signals such as
environmental parameters (speed, pressure, and
temperature). Speedometers, road lamps with sensors,
meteorological machines can be given as examples.
1. Computers designed for usual and day - to - day activities are called General Purpose Computers.
2. Computers designed for special purposes such as scientific experiments, battle operations, discovery of
oil rigs etc. are called Special Purpose Computers.
6
Computer Ports
7
Data Communication
8
9
10
11
(ii) Switch/Hub
Switch/Hub acts as the mediator to build a connection between two or more computers. (Figure 2.74) A
guided/wired transmission media is used. One end is connected to port in the computer and the other end is
connected to the port in the Switch / Hub.
12
13
Client/Server network
14
(iii) Wide Area Network - WAN
These networks cover a wide area. This can be within or outside a
country. The best example for WAN is the Internet.
Network Topology
Network topology is the pattern of connection in designing computer network. There are different types of
network topologies. Those are,
i) Star Topology
This is a commonly used design and built by centralizing a switch/hub and computers.
15
v) Mesh Topology
All the computers in the network are connected with each
other. Since this is a complex connection pattern, it is costly
and difficult to control. However, a breakdown of one
computer does not affect the connections in the network.
Mesh networking can be found on internet.
Benefits of Networking
16
Disadvantages of Networking
17
2.3 Explores the evolution of computer architectures.
Computer Architecture
18
Data and instructions fed to the computer via an input device are stored in the primary memory. The data
and instructions are used by the CPU for processing. The processed data are stored in the Primary Memory
as information and send to the output device. The data and information which is to be stored are send to
Secondary Storage device. The stored information can be sent an output device through Primary Memory.
Control Unit sends the control signals to all the devices attached to the computer system.
The flow of the data and instruction is indicated by a dotted line and the control signals are indicated by a
solid line in the diagram above.
An instruction cycle (sometimes called fetch-decode-execute cycle) is the basic operation cycle of a
computer. It is the process by which a computer retrieves a program instruction from its memory, determines
what actions the instruction requires, and carries out those actions.
First of all, both the data and the program that acts upon that data are loaded into main memory (RAM) by
the operating system. The CPU is now ready to do some work.
1. FETCH
The first step the CPU carries out is to fetch some data and
instructions (program) from main memory then store them in its
own internal temporary memory areas. These memory areas are
called 'registers'.
This is called the 'fetch' part of the cycle. For this to happen, the
CPU makes use of a vital hardware path called the 'address bus'.
The CPU places the address of the next item to be fetched on to
the address bus.
Data from this address then moves from main memory into the
CPU by travelling along another hardware path called the 'data
bus'.
You could imagine that it is a bit like a boat attendant at a lake calling in customers when their time is up --
"Boat number 3, time to come in!" The 'address' of the boat is 3 and the 'data' is its content. The boat is
parked at a pier, which is like the internal register of the CPU.
2. DECODE
The next step is for the CPU to make sense of the instruction it has just fetched. This process is called
'decode'. The CPU is designed to understand a specific set of commands. These are called the 'instruction
set' of the CPU. Each make of CPU has a different instruction set.
The CPU decodes the instruction and prepares various areas within the chip in readiness of the next step.
19
3. EXECUTE
This is the part of the cycle when data processing actually takes place. The instruction is carried out upon the
data (executed). The result of this processing is stored in yet another register.
Once the execute stage is complete, the CPU sets itself up to begin another cycle once more.
In order to appreciate how the Fetch-Execute cycle works you need to have a basic understanding of the
three main parts of a CPU. These are the:
Control Unit
Immediate Access Store (IAS)
Arithmetic and Logic Unit (ALU)
1. It controls and monitors the hardware attached to the system to make sure that the commands given
to it by the application software are used. For example, if you send something to print, the control
unit will keep a check that the instructions are sent to the printer correctly.
2. It controls the input and output of data so that the signals go to the right place at the right time
3. It controls the flow of data within the CPU - which is the Fetch-Execute cycle described above.
This holds the data and programs needed at that instant by the Control Unit. The CPU reads data and
programs kept on the backing storage and stores them temporarily in the IAS's memory.
The CPU needs to do this because Backing Storage (e.g. the hard disk) is much too slow to be able to run
applications directly.
For example, let's imagine that a modern CPU was slowed down to carry out one instruction per second. In
this scenario, the hard disk slowed down to an equivalent rate would take three months to supply the data
needed by the CPU!
So data and programs are first of all loaded into main memory then the CPU fetches just the part it
immediately needs and loads it into its own internal registers as part of the Fetch-Execute cycle.
This is where the computer processes data either by manipulating it or acting upon it. It consists of two
parts:
1. Arithmetic part - which does exactly what you think it should - it performs the calculations on the
data e.g. 3 + 2 = 5
20
2. Logic part - this deals with logic and comparisons. For example, it works out if one value is greater,
less than or equal to another.
Clock speed
Computers can only do one thing at a time. It may appear that many things are happening simultaneously,
for example you may be listening to music while writing an essay and also downloading some software in
the background.
In reality, the computer can only process one instruction at a time. It is just that the machine is so fast, to
you, everything seems to happen at once.
A CPU processes digital data by taking each piece of data one-at-a-time and doing something with it. The
amount of time that it has to process each piece of data is controlled by a quartz clock inside the CPU.
With every tick of the clock, the CPU is able to process one
piece of data or execute one instruction.
It is hard to imagine just how fast this is, but it does mean that a CPU running at this clock speed can handle
a huge amount of data in a very short time. This is why you can listen to music on the computer while you
are also browsing the web and doing some work.
Naturally the speed of the clock determines the basic performance of the CPU - the faster it goes, the more
powerful the computer.
Number of cores
Now imagine that the clock cannot be sped up any more for technical reasons. How would you improve
performance?
A sensible way forward is to use two CPUs at the same time. The job in hand is shared between the two
CPUs.
In an ideal world, running two CPUs would give you twice the performance. In real life this is not quite the
case because many applications have not been written to take advantage of extra processors.
However, by having more than one processor, you would certainly see an improved performance.
A modern processing device may contain two or even four CPUs. Some chip-making companies call these
CPUs 'cores'. So a dual-core device means it contains two CPUs and a quad-core contains four.
The Cache
Most data is stored on the hard disk. When we use that data, it is loaded into Random Access Memory
(RAM) because it is much faster to access the data from RAM than from the hard disk.
21
When we looked at the 'immediate access store' earlier, we found out that the CPU needs to access data
very quickly. Although RAM is faster than the hard disk, it still isn't fast enough to cope with the speed that
the CPU needs to deal with data.
The way around this, is to store as much data as possible, as close as possible to the CPU to avoid delays.
This nearby storage area is called the 'cache'.
The cache is a special type of computer memory which can be accessed much faster than RAM. The CPU
looks in the cache for the data it needs. If the data is there, it will retrieve it and process it. If the data is not
there, then the CPU accesses the system memory and then puts a copy of the new data in the cache before
processing it.
Cache memory is volatile i.e. when the computer is shutdown, the data stored there is lost.
Thus, in order to improve the computer's performance, it is important to keep the local cache full at all times
so that the CPU doesn't have to wait around with nothing to do.
The larger the cache size, the better the performance because you are able to store more data locally.
An example of an instruction set is the x86 instruction set, which is common to find on computers today.
Different computer processors can use almost the same instruction set while still having very different
internal design. Both the Intel Pentium and AMD Athlon processors use nearly the same x86 instruction set.
An instruction set can be built into the hardware of the processor, or it can be emulated in software, using
an interpreter. The hardware design is more efficient and faster for running programs than the emulated
software version.
22
Operand Storage in the CPU
Where are the operands kept other than in memory?
Number of explicit named operands
How many operands are named in a typical instruction.
Operand location
Can any ALU instruction operand be located in memory? Or must all operands be kept internaly in
the CPU?
Operations
What operations are provided in the ISA.
Type and size of operands
What is the type and size of each operand and how is it specified?
in all 3 architectures:
POP C - -
Not all processors can be neatly tagged into one of the above catagories. The i8086 has many instructions
that use implicit operands although it has a general register set. The i8051 is another example, it has 4 banks
of GPRs but most instructions must have the A register as one of its operands.
What are the advantages and disadvantages of each of these approachs?
Stack
Accumulator
23
Advantages: Short instructions.
Disadvantages: The accumulator is only temporary storage so memory traffic is the highest for this
approach.
GPR
Advantages: Makes code generation easy. Data can be stored for long periods in registers.
Disadvantages: All operands must be named leading to longer instructions.
Earlier CPUs were of the first 2 types but in the last 15 years all CPUs made are GPR processors. The 2 major
reasons are that registers are faster than memory, the more data that can be kept internaly in the CPU the
faster the program wil run. The other reason is that registers are easier for a compiler to use.
CISC Architecture
Stands for "Complex Instruction Set Computing." This is a type of microprocessor design. The CISC
architecture contains a large set of computer instructions that range from very simple to very complex and
specialized. Though the design was intended to compute complex instructions in the most efficient way,
RISC Architecture
RISC (reduced instruction set computer) is a microprocessor that is designed to perform a smaller number of
types of computer instructions so that it can operate at a higher speed (perform more millions of
instructions per second, or MIPS). Since each instruction type that a computer must perform requires
additional transistors and circuitry, a larger list or set of computer instructions tends to make the
microprocessor more complicated and slower in operation.
24