System Architecture (CPU)

Computer Systems

When we think about computers, we often picture a laptop or desktop computer, or maybe even a smartphone or tablet. However, a computer system is (in reality) just a programmable machine whose job it is to input, process and output data. This means that there are several different types of computer system.

General purpose systems are used for lots of different things and include desktop and laptop computers as well as smartphone and tablets.

Embedded systems are where the computer works as part of a larger system, for example the computer system in a car, or a micro controller in a washing machine. They are only designed to do one specific task, so are often simpler than a general purpose computer.

In an embedded systems, the main memory and CPU are just one component, whereas they are physically separate in a non-embedded system. The programs used by an embedded device are also likely to be stored in__ ROM__ instead of RAM. This means that an embedded system is likely to have more ROM than RAM and indeed, less likely to require secondary storage.

Von Neumann Architecture

In a computer system, the CPU (Central Processing Unit) and memory work together to run programs. In particular, the CPU executes (runs) programs using the fetch-decode-execute cycle, whilst the memory (registers, cache, RAM and virtual memory) store the data and programs that are currently in use.

This wasn’t always the case. The very first computers were unable to store programs, and every time they were used, the inputs needed to be set using different switches. In the 1940s, John Von Neumann developed a new concept that would allow programs to be stored called the stored program computer.

The key features of Von Neumann Architecture are:

  1. There is a single memory (and bus system) for accessing both data and programs
  2. The program stored in main memory and instructions are fetched and executed sequentially.

The way this works is known at the fetch-execute__ __cycle.

System Architecture (CPU), figure 1

Fetch-Decode-Execute

The CPU continuously reads instructions stored in main memory and executes them as required. When a program is run, it is first loaded into the main memory. This allows the CPU to access it directly. The processor is told the address in memory of the start and fetches each instruction in turn.

Once it has fetched one instruction, the Control Unit in the processor then works out what it needs to do. This is called decoding. Finally, the instruction is __executed __i.e. carried out. This may include reading/writing from/to main memory.

CPU components

The CPU is made up of a number of different components:

  1. Arithmetic logic unit - carries out the arithmetic and logical operations required.
  2. Control unit - this decides what is supposed to happen and tells the memory, ALU and other devices what they are expected to do.
  3. Clock - a signal which is used to synchronise everything inside a computer.
  4. Bus - a collection of wires through which data is transmitted from one component to another.

CPU Performance

How fast a computer can run depends on a number of factors:

Clock speed

This determines how many instruction cycles a processor is able to process every second. A clock speed of 2 gHz (gigahertz) for example would mean that 2 billion instruction cycles are processed every second.

The higher the clock speed, the more instructions can be processed every second, so the faster the processor. However, more instructions processed means more heat, and more power consumed, so all processors have a maximum ‘safe’ clock speed. This can be manually overridden which is known as overclocking.

Number of processor cores

A__ CPU__ often will contain a number of processing units known as cores, each one consisting of an ALU and a Control Unit, as well as very temporary memory known as registers. The number of cores a processor has determines how many instructions it can process at the same time. The more cores, the faster the computer.

Most devices are dual-core (2 cores) or even quad-core (4 cores), meaning that they can process instructions faster than a single core processor. However, they are not quite double (or quadruple) the speed due to the way they communicate with each other to process the instructions.

Cache size and type

Next to the CPU is a very fast (and expensive) type of memory called cache memory. This is where instructions that the computer is likely to reuse are stored. Since constantly fetching instructions from__ RAM can be slow, the __CPU checks the cache memory for instructions before checking RAM, to help speed up the process. This means that the more cache there is, the more of these quick reference instructions can be stored, and therefore the faster the computer can run.

There are different types of cache memory too:

  1. L1 cache - usually between 8-64KB, it is part of the chip itself, and therefore the fastest to access.
  2. L2 cache - next closest to the CPU and sometimes even built into it.
  3. L3 cache__ __ - the furthest type of cache available, and therefore takes the longest to access.

L1 cache is limited in size due to its proximity to the CPU, however, L2 and L3 cache have a little more flexibility (although still quite limited), so can be expanded. L2 and L3 cache is usually shared between cores, but L1 cache is only available to the core it is attached to.

For each of these statements answer with True or False:

A dishwasher contains an embedded computer.
True
The ALU is responsible for decoding instructions and telling hardware what to do.
False
A quad-core processor will run twice as fast as a dual-core as it contains twice as many cores.
False
L1 cache is the slowest type of cache.
False
Increasing the cache size will make the computer run slower as it has further for the data to travel.
False