Presentation 8: CPU

Overview

What is it like not to have a memory? It makes one helpless and confused. This is how the processor is - it is smart, it can calculate, but it has no memory and it's very confused. It needs a very clear directions about what to do - instructions. We look at instructions that we can give to the processor to do simple arithmetics and how registers are used.

Resources

A sheet of paper and a pencil for every child.

Presentation

No Memory.

Computers have a "heart" - it's called a processor. It's the main component of the computer that allows it to do anything. Processor is very very smart - it can add and subtract numbers extremely fast. But it has a flaw. IT HAS NO MEMORY!

Imagine what it's like not to have a memory?

Have kids think about it. 

(One boy said: "Oh, it's like my dad!")

Imagine you wake up and you have no memory. What is it like?

Imagine you come to school and you have no memory. What is it like?

Right, you feel confused, you don't know who you are and what you need to do!

Computer processor is like that - it's always confused and unsure what to do next. That's why it needs very precise instructions. Do this, then do this.

Registers

Now, despite lack of memory, a processor is really good at adding numbers.

So imagine we tell it: Please add 5 and 3.

The processor will go like this:

- Add what number?

- 5!

- 5 and what?

- and 3!

- 3 and what?

- and 5!

- and what am I supposed to do with 5?

It needs help remembering stuff, like a box where it can put a number so it can look in the box later on and see what it stored there.

These boxes are called registers. There are limited number of these boxes on a processor, let's say 3

Box A and B -  to store the numbers 

Box C - to store result

So, let's say you want a processor to add 5 and 3. You need to give it detailed instructions - how to put the numbers in boxes:

Put 5 in A

Put 3 in B

Put A+B in C

(The idea of boxes is a good preliminary for algebra and variables)

Exercise 1.

Write instructions to add 1034 and 370

(Some kids had easier time calculating the result in their head than writing the instructions)

Give kids a few minutes and show the solution on a board

Complex instructions

Let's say we want computer to add 5 and 9 and 12

We would have to write the following instructions:

Put 5 in A

Put 9 in B

Put A+B in C

...

But now we still have 12 to add. Therefore we move the content of box C into box A, put 12 into box B and put the result in C.

... 

Put C in A

Put 12 in B

Put A+B in C

Exercise 2.

Write instructions for 12+349+23

Show kids solution once they try it themselves

(I then proceeded to explaining binary to the kids, which is not really part of this presentation, but makes a good complement)