Computers in the real world Objectives - PowerPoint PPT Presentation

1 / 41
About This Presentation
Title:

Computers in the real world Objectives

Description:

This says how many CPU cycles can be run ... These both connected to the motherboard using different ... Next time your in PC world ask how much cache is in each ... – PowerPoint PPT presentation

Number of Views:78
Avg rating:3.0/5.0
Slides: 42
Provided by: couk
Category:

less

Transcript and Presenter's Notes

Title: Computers in the real world Objectives


1
Computers in the real worldObjectives
  • Understand what role the CPU plays in a computer
  • Understand how CPU performance is measured
  • Look at the different parts of a CPU
  • Explore the idea of an instruction set and run
    simple programs in an assembly code emulator.

2
Computers in the real worldWhat is a CPU?
  • Remember the term micro-processor?
  • The CPU is the microprocessor!
  • CPU stands for
  • Central Processing unit
  • It is referred to as micro as, errr, its small ?
  • It is the brains of the computer
  • It co-ordinates all of the hardware by running
    software.

3
Computers in the real worldWhat is a CPU?
  • Remember the term micro-processor?
  • The CPU is the microprocessor!
  • CPU stands for
  • Central Processing unit
  • It is referred to as micro as, errr, its small ?
  • It is the brains of the computer
  • It co-ordinates all of the hardware by running
    software.

4
Computers in the real worldHow the CPU
communicates
1. Software, like office, are stored on the hard
drive. To run the software we must load it.
Software
CPU
Hard drive
Memory
5
Computers in the real worldHow the CPU
communicates
2. The operating system (like windows) will be
running on the CPU. When the user selects to load
office up, it is the OS which starts it off.
Software
CPU
Hard drive
Memory
6
Computers in the real worldHow the CPU
communicates
3. Software is loaded from the hard drive and
stored in main memory
Software
CPU
Hard drive
Memory
7
Computers in the real worldHow the CPU
communicates
4. The CPU then transfers instructions from
memory into the CPU in order to run them. It does
this ONE at a time!
Software
CPU
Hard drive
Memory
8
Computers in the real worldThe bus
The CPU is connected to other devices using a
bus. This is a circuit which connects the devices
together. It has 3 parts Address bus where to
find data Data bus data is loaded/saved over
this line Control bus says if it is loading or
saving
Memory
CPU
9
Computers in the real worldWhat is an
instruction?
A CPU can perform a set number of tasks such as
adding, subtracting etc. One of these is known as
an instruction. All of the instructions together
is known as a instruction set.
CPU
Different types of micro-processor will have
different instructions sets.
10
Computers in the real worldWhat does an
instruction look like?
Instructions on the CPU are written in binary
0001 1000 A add instruction in binary
1 08 The same instruction as a normal number
CPU
ADD 8 What the computer sees and understands
11
Computers in the real worldOpcodes and data
Instructions have two parts to them.
ADD 8
Opcode
Data
The opcode tells the CPU what to do. ADD tells
the CPU to add two numbers together. The data
part of the instructions tells the CPU what to
add. In this case 8. The question is what do we
add to? How does it work! What is this
opcode? All shall be revealed!
12
Computers in the real worldInstruction set of a
simple computer
Below is a table showing the instructions of a
simple computer called the LMC or little man
computer.
Opcode Name Data Explanation
1xx ADD The number to add It will add a value from a register to the current value of the ACC
2xx SUB The number to subtract It will subtract value from a register to the current value of the ACC
3xx STA Stores a value into a register Will take the contents of the ACC
5xx LDA Loads a value from a register Will take a value from a register and store it in the ACC
6xx BRA Line number to jump to. Unconditional branch. Will jump to the given instruction number.
7xx BRZ Line number to jump to. Branch if zero. Will only jump if the ACC is zero
8xx BRP Line number to jump to. Branch if positive. Will only jump if the ACC has a positive value.
901 INP Input from the user Will input a value and store it in the ACC
902 OUT None Will output the contents of the ACC
13
Computers in the real worldReal CPUs
Real CPUs have different instruction sets.
Programs written in one instruction set CAN NOT
be run on the other
ARM ARM processors tend to be found on devices
such as mobile phones or other portable devices.
They have the advantage of using less electricity
than desktop CPUs
x86 Desktop and laptop computers use x86. This
instruction set was created a long time ago.
Companies such as Intel and AMD create these
types of micro-processor. Each of these companies
add their own special instructions in a attempt
to speed things up.
14
Computers in the real worldThink of instruction
sets as...
Instruction sets can be thought of as a language.
A French speaker could not talk to a mandarin
speaker as they would not understand each other
15
Computers in the real worldRegisters
A register is a small block of FAST memory stored
on the CPU. Instructions will use the registers
when they run
A CPU will have small blocks of memory called
registers. These are used to store calculations
as the processor runs. As a program runs it will
load / store values into the registers until it
comes to the final result. Think of it like a
table in your notebook. Each register can hold a
separate number!
Register Value
1 8
2 5
3 1
16
Computers in the real worldACC register
The ACC stands for accumulator. It is used in all
calculations and answers are ALWAYS stored into
the ACC.
The ACC acts like the display on a calculator.
What happens when you type in. 10 5 The
result is stored on the display! In fact the
calculator also uses an accumulator and has its
own micro-processor! Hopefully that is not too
surprising!
17
Computers in the real worldA sample program to
add 2 numbers
The program below will display the result of
adding 2 numbers.
INP STA 1 INP ADD 1 OUT
ACC - Register 1 -
Let us look at how this program works.
18
Computers in the real worldA sample program to
add 2 numbers
The program below will display the result of
adding 2 numbers.
INP STA 1 INP ADD 1 OUT
ACC - Register 1 -
ACC - 12 Register 1 -
INP The user will be asked to enter a number
onto the computer. The user enters the value 12.
19
Computers in the real worldA sample program to
add 2 numbers
The program below will display the result of
adding 2 numbers.
INP STA 1 INP ADD 1 OUT
ACC - 12 Register 1 -
ACC - 12 Register 1 - 12
STA 1 The ACC is then saved into register 1. If
we did not then the next INP instruction would
overwrite it.
20
Computers in the real worldA sample program to
add 2 numbers
The program below will display the result of
adding 2 numbers.
INP STA 1 INP ADD 1 OUT
ACC - 12 Register 1 - 12
ACC - 5 Register 1 - 12
INP The user will be asked to enter a number
onto the computer. The user enters the value 5.
21
Computers in the real worldA sample program to
add 2 numbers
The program below will display the result of
adding 2 numbers.
INP STA 1 INP ADD 1 OUT
ACC - 5 Register 1 - 12
ACC - 17 Register 1 - 12
ADD 1 Will take the value in register 1 and add
it to the ACC. It then stores the result into the
ACC
22
Computers in the real worldA sample program to
add 2 numbers
The program below will display the result of
adding 2 numbers.
INP STA 1 INP ADD 1 OUT
ACC - 17 Register 1 - 12
OUT Will display the contents of the ACC on the
screen.
23
Computers in the real worldparts of the CPU
A CPU has a number of different parts inside it.
CU
Registers
CU Control Unit ALU Arithmetic logic unit MU
Memory unit
ALU
MU
24
Computers in the real worldControl unit
The control unit will communicate to devices over
the buses. For example the hard drive or the
graphics card. It also manages the CPU to allow
it to run instructions.
CU
25
Computers in the real worldALU -
The arithmetic logic unit (ALU) will perform any
maths related operations and any comparisons. So
instructions like ADD, SUB and BRZ will be run by
the ALU.
ALU
26
Computers in the real worldMU
The memory unit (MU) is responsible for
communicating with memory. It allows data to be
loaded and saved. It is also referred to as the
Intermediate access store (or IAS)
MU
27
Computers in the real worldActivity
Make notes on the following in your revision
power point. The parts of a CPU What is a
register? What does the ACC do?
28
Computers in the real worldClock cycle
CPUs are measured by something known as the
clock speed. This is a number measured in hertz.
This says how many CPU cycles can be run per
second. The bigger the number the more clock
cycles can be run per second. So a 2Ghz is
technically slower than a 3Ghz processor.
Clock cycles are used to synchronize the CPU to
ensure that the next instruction is not run
before the previous one has completed. The
shorter the cycle means the more instructions we
can run in a single second.
However some instructions need more than one
clock cycle!
29
Computers in the real worldSo higher clock rates
are what we want?
Sadly no. Sometimes a CPU with a high clock speed
(3.3Ghz) may be slower than one with a lower
clock speed (2.4Ghz). Although it does mean more
instructions can be run per second on a higher
clock speed there is a draw back to this. Most of
the time the CPU is idle!!!
The reason why is that clock speed is only one
measure of a CPU and is certainly not the most
important.
  • Other things you need to consider are
  • The architecture of the CPU
  • If it is 32bit or 64bit
  • The speed of the buses.
  • Are there any bottle necks in the system (eg slow
    hard drive)
  • How many cores are on the CPU?
  • How big is the cache?

30
Computers in the real worldArchitectures
CPUs are put together in different ways. As
CPUs improve so does the way they handle
instructions and talking to hardware. Normally
when companies like Intel release a new processor
architecture it will run at a lower clock speed.
They then will try to increase the clock speed
until the next architecture comes along.
For example in 1993 Intel released the Pentium
processor. In 1997 they then released the Pentium
II processor. These both connected to the
motherboard using different slots.
A motherboard can only accept a very limited
number of different CPU architectures. As such
when a new CPU architecture comes out it may
require a brand new way of connecting it to the
CPU.
31
Computers in the real world32 or 64 bit
Most CPUs run in 64bit currently. However there
are still a LOT of processors still running in
32bit. So what does this mean?
  • Computers store numbers and other data in binary.
    32 bits mean that we can store up to
    2,147,483,647 while in 64 bit we can store
    9,223,372,036,854,775,807 . (signed integers).
    That means that we can deal with bigger numbers
    more efficiently. This is great for doing things
    like
  • Academic research (universities)
  • Decoding/encoding movies and music
  • Games!

IMPORTANT! Each piece of software must be
compiled to work on 64bit. You can buy windows 64
bit but it does not mean your other programs will
also be 64bit!
32
Computers in the real worldFront side bus
Remember that buses connect the CPU to each of
the other devices on the computer. The bus is
part of the motherboard.
Buses transfer data to and from the CPU. The rate
at which data can travel across this is measured
in hertz. CPUs are built to handle different
front side bus speeds. The faster the speed the
faster data can be transferred to/from the CPU.
IMPORTANT! The CPU will spend most of its time
waiting for devices to transfer data. Anything
which can speed this up will greatly improve the
speed of the system.
33
Computers in the real worldCore blimey!
A dual or quad core processor essentially means
that it can run multiple instructions at the same
time. Dual can run 2 and quad can run 4. Each
core acts like a separate processor.
This speeds up multitasking. Essentially it means
that different processes can be run on different
cores. Reducing the load on a individual core.
However a single program gains NOTHING from extra
cores unless it has been programmed specifically
to use them.
Having more cores will not improve the speed of a
system unless you are running lots of different
programs which require a large amount of CPU
time. Normally you are still restricted by
bottle necks such as the hard drive or the
internet.
34
Computers in the real worldSpeed mismatch the
true cause of a slow system!
This graph shows the speed difference between how
long it takes to perform a task. The longer the
bar the slower the device. As you can see the
CPU is much faster than the internet or even the
hard drive.
35
Computers in the real worldBottlenecks in the
system
So will a faster computer make your internet
faster? The answer is unlikely. It would be
faster creating the page but the CPU would still
have to wait for the data to be sent over the
telephone lines.
Your hard drive is also a big bottle neck. When
you load a program or load a file it needs to be
transferred from the hard drive to memory. While
this is happening the CPU will not be doing much!
36
Computers in the real worldReally?
Yeah really! Look at the graph below -
This shows how busy the CPU is as a program is
loaded (in this case Microsoft publisher). The
CPU is used for very short bursts then not much
else happens until another big burst. The CPU is
idle for most of the loading. This shows that the
hard drive is slowing the CPU down!
37
Computers in the real worldI like Cache!!
The cache is a small block of FAST memory stored
either in the CPU or in-between the CPU and
memory. Anything stored in the cache can be
accessed MUCH faster than if it was accessed from
main memory.
If you turned the cache off your computer would
run at about 10 of its current speed. Yes cache
has that much of a impact on your system!
So why do computer manufactures not tell you how
big / last the cache is? Well they think you guys
are dumb and need things simple! Next time your
in PC world ask how much cache is in each laptop
you see. That will confuse them. Now you know
what I do with my weekends ?
38
Computers in the real worldHow does cache speed
things up?
When programs are fetched from memory the are
stored in the cache. The CPU will look at the
cache first for an instruction. If it is not in
cache then the CPU will access it from main
memory which is much slower. This is known as a
cache miss.
Cache ADD SUB BRA
Fetch instruction
Cache miss Have to access from memory
39
Computers in the real worldThe 80/20 rule
A computer spends 80 of its time in only 20 of
the instructions. Later you will find out why
this is! Cache takes advantage of this by putting
that 20 of the code into the fast cache. That
reduces the amount of cache misses and thus
increases the speed of the system as whole!
Cache ADD SUB BRA
Fetch instruction
Cache miss Have to access from memory
40
Computers in the real worldWhy not make memory
our of the same stuff as cache?
Eventually they do! However there is some huge
hurdles to overcome for that and it takes memory
manufacturers to make cache bigger and enable it
to act as main memory. Also there is a big cost
factor. Cache memory is very expensive so the
more we use the more expensive the system will
be.
Bright computer science type people have worked
out that the speed increase you would get is very
small over just having cache. This is mainly due
to the 80/20 rule.
41
Computers in the real worldActivity
Explain in as much detail as you can What
effects the speed of a CPU?
Focus on the following ONLY Cache Cores Clock
speed These are the main ones you need for the
exam. The others I have included for completeness.
Write a Comment
User Comments (0)
About PowerShow.com