Skip to content

How computers work, for children.

Have you ever wondered how computers work? And have you asked someone?

A lot of grown-ups do not understand how computers work, so I suppose if you did ask someone, they’ll have told you something helpful like “I don’t know love, why don’t you ask Daddy” or “Computers are very clever. That’s how they work” or, even more helpful, “Computers work by magic”. I’ll bet that none of these answers really satisfied you. But you’ll be amazed to know that there is a grain of truth in all of these answers…except one. Computers are not clever. We haven’t worked out how to make them clever yet – oh I know that every so often there comes along a supercomputer which beats the great genii of the world at chess. But you’ll have to remember that while a computer might beat a human at chess, it’s highly unlikely that the same computer would be able to make scrambled eggs for the breakfast. It’s a chess playing machine, designed to play chess, and nothing else. I think to call something or someone clever, they need to be able to do more than one thing.

So I said that there might be a grain of truth in the statement “I don’t know love, why don’t you ask Daddy?” and more particularly, in the statement “Computers work by magic.” But first you need to understand what magic is. Magic is more than someone waving a magic wand and crying “Abracadabra”. Although it might look impressive at the pictures when you go to see Harry Potter, magic is really very simple. It’s knowing something extra that most other people do not know. So, when you think about it, magic is nothing particularly special at Hogwarts School. Everyone can do it. Ron Weasley’s mother uses it to do the housekeeping. Magic is only amazing to us Muggles because we don’t know how it works. If we did, would it matter so much? Probably not. So, there’s nothing particularly special about how computers work, it’s just that a lot of people don’t know it. That’s where the magic comes in. We are going to learn the things that a lot of grown-ups do not know and when we know that, we’ll know that computers don’t really work by magic.
There’s a simple question that confuses a lot of people. What is a computer? If you try to describe a computer, what do you come up with? The simplest possible description of a computer which you can probably think of is that it’s a box with a television and a keyboard. Well, the television bit and the keyboard bit, they aren’t very important in understanding how a computer works right now. We just use them to be able to 1) tell the computer what to do and 2) see what the computer is doing. We can forget about them for now. There’s a special word to describe these bits. The keyboard is an input device and the screen is an output device. The real beef is in the box. Once upon a time, those boxes used to be a really yukky vomit type colour – not very nice – and then a company called Apple decided it might be nice if they came in different colours. Black is the most popular at the moment, thanks to Dell Computers – I’m sure you’ve seen the advertisements on television – that’s not very exciting either. It is better than vomit though.
There’s nothing particularly special about a box. But we treat computers with a lot of respect. Some people fear them. Some people treat them with love. People have feelings about computers. When you think about it, that’s just a little bit worrying. After all, a computer is just a piece of machinery in a box. There aren’t little fairies and elves dancing around inside in it – and I don’t care if that’s what your uncle Liam told you. Besides, fairies and elves fight. If they were stuck in a small box, there would be a big explosion within a day. No computer would survive very long, although I suspect the fireworks would be good.

Why do people treat computers differently to other machines? Why do people fear computers, but not dishwashers? What’s the difference between a computer and a lawnmower? I’m not saying you need to be afraid of a dishwasher – I’m sure if you check with your mother, she’ll tell you the dishwasher is the greatest invention ever – but dishwashers don’t feature in big Hollywood movies – did you see a single dishwasher in Star Wars™? I didn’t. A couple of robots and computers all over the Star Destroyer but no dishwashers.
What does a computer do anyway? Dishwashers wash dishes. Toasters toast bread. Lawnmowers cut grass. Computers compute, right? What is computing? That’s a nasty question to ask. Computing now means a lot of things and…nothing. But computing used to mean something very specific. It used to mean working out sums. Doing big complicated sums. And right down at the bottom of things, all a computer does is sums.
However, computers don’t decide to do sums all by themselves. Anyway, a computer is stupid. It won’t know what
to do unless you tell it.
Now, if you want to get the dishes washed by the dishwasher, the chances are, all you have to do is turn a dial a special way and then press the button. And some time later, you’ll find a dishwasher full of clean ware. You instruct the dishwasher to wash the ware. Most dishwashers, they have maybe three basic instructions 1) normal wash 2) gentle wash and 3) really dirty pots wash. You choose which wash you want, and then press the button and the dishwasher does what you tell it. A computer has instructions too. Unfortunately, those instructions are nothing like as useful as 1) normal wash 2) gentle wash and 3) really dirty pots wash.
Most computer have about 100 instructions, including “Add” and “Load In” and “Send Out”. But computers don’t understand English. They understand something called machine code and that code consists of just numbers. Each instruction for your computer has a machine code – and to get the computer to do anything at all, we need to feed it the machine code. It understands the machine code.

hopscotch

I guess you’ve seen one of these before. It’s a hopscotch grid. There are a lot of different ways to play hopscotch, but we’re going to look at one of them. It’s the one where you have to jump a different sequence of numbers on the grid.

Let’s say you’re standing at the bottom of the grid, and you need to jump to 10. Well, depending on your luck, you’ll get to jump a simple sequence like 1 2 3 4 5 6 7 8 9 and then 10. If you’re unlucky, you’ll get something like 1 4 5 8 9 10. Two big jumps in there. Not very good if you aren’t tall.
The task you have to carry out is to jump from 1 to 10 and the route you take depends on the instructions like:

Jump to 2
Jump to 3 and so on until you get to ten.

You can shorten the instructions to code numbers, i.e. 2, 3, 5,6. Hopscotch code, if you like.

Machine code is just like hopscotch code. You can feed it in a series of numbers, and these numbers represent instructions for the computer to carry out. At the very base of things, all a computer does is read instructions and carry them out. And it is so dumb, it will not know if the code it gets is rubbish and will just execute it. Execute is a big word – why use a small one when a big word will mean the same thing – and all it means is “do”. A computer does what you tell it to. It executes your instructions. You are the boss. There’s a special thing inside the computer that “does” things and we’ll call that the “Bit That Does Stuff”.

The next question is, how does the box do this. How is the box put together so that it can do what you tell it to? Is it like Calvin and Hobbes and the transmogrifier – which is just a cardboard box with “transmogrifier” written on the side? If you grabbed the box your mother collected the shopping in and scribbled “computer” on the side, would it work?
Honestly speaking? No, it wouldn’t. You are going to need more stuff inside the box.
Think about this. Maybe you have a pet dog and maybe he can do tricks. But for you to get him to do tricks, you need to be able to get him to “remember” an instruction. It will take a while for him to “know” how to sit when you tell him to “sit”. A computer is a little bit like that. Inside a computer, you have the bit that does the trick – that does what you tell it to do – but you can’t tell it to do that directly. You need to train a computer to do this. You do this by placing your instructions into the computer’s memory. Computers have a memory. They don’t have emotions and they won’t love you like your dog does, but they will remember things when you put things into their memory.
Maybe you go shopping with your mother, and she brings a list. A shopping list is like a set of instructions. You arrive at the shop, and your mother looks at the list and the first thing on it is chocolate. So she looks at the list and reads “chocolate”. What does she do? She goes and gets chocolate and throws it into the trolley. Then, she reads the list again, and the next thing on the list is dishwasher tablets. So she goes and gets dishwasher tablets. A computer works a little bit like this. You put the instructions into the computer memory and the bit that does stuff gets each instruction, does it, and gets the next instruction. This is called the fetch-execute cycle – another fancy way of describing things which means “tell me what to do and I’ll do it and tell me what to do next, and I’ll do that too”.

A computer memory isn’t like your memory. You just remember things, right? Well, a computer needs to know how to remember things. When you put something into a computer memory, you need to tell the computer where in its memory you put that thing. Maybe you have a toyshelf and each toy has a special place on the toyshelf. For example, Pooh Bear always sits on the shelf next to your bed, and the Duplo™ bricks are always next to Pooh Bear. And you know that when you are putting the Duplo™ bricks back on the shelf that they are kept next to Pooh Bear. The address of the Duplo™ Bricks is “next to Pooh Bear” or the second space on the shelf counting from your bed. Each space inside the computer has an address too. And addresses in computers are nothing more than numbers. So, for example, Pooh Bear would be at address 00, and the Duplo™ bricks would be at 01 if your shelf was organised like the memory inside a computer. And if you tell a computer what address to go to, it will go there and get what is stored there. This means you can get information from any part of the computer so long as you know what address to look at. There’s a special name for this in computer language and that is “random access memory”, or RAM.

We are just going to look very quickly at how this all fits together. You know now that there’s a bit that does stuff, and you know that there’s a memory and you know that stuff has to get from memory to the bit that does stuff.

The Bit That Does Stuff.

This is the bit of the computer that does what you tell it to. It does this instruction by instruction. Think about the hopscotch code again. You know the first instruction is 1. Well, the bit that does stuff needs to know that the first instruction is 1, so it gets the 1 from somewhere – just give me a moment and I’ll explain where – and it saves it somewhere so it can’t forget what exactly it’s doing. Maybe it has a little blackboard inside and it writes that instruction down so it won’t forget to do it. We call this blackboard the “instruction register”.

The Bit That Knows Where To Get Stuff from Memory

Now, we have to find a way of getting the instruction from memory and writing it on the blackboard inside the Bit That Does Stuff. Remember I said everything is stored at an address in memory? Well, next to the bit that does stuff you have a bit that sends each instruction individually, say, the feeder. So, when the Bit That Does Stuff has done stuff, it gets the next instruction from the feeder. Try to imagine playing hopscotch with the computer. You have told the computer that the hopscotch code is 1 3 4 5 7 9 10 and you have stored these hopscotch codes in the computer memory at addresses 0 to 6.

The computer can do nothing unless you tell it where the instructions are. You could, if you wanted, try to put the address of the code into the Bit That Does Stuff. The address is 0, right? The Bit That Does Stuff will think “ah, this is the hopscotch code and I must step on to 0”. But there’s no 0 on the hopscotch grid. Clearly, the computer is going to be pretty useless at hopscotch if it tries to do that. So what actually happens is, next to the Bit That Does Stuff you have the feeder which is a Bit That Knows Where To Get Stuff from Memory. You feed 0 into this and it will go to memory and get the instruction at address 0 and feed it over to the Bit That Does Stuff. Now, you know, the instruction at address 0 is 1. The Bit That Does Stuff will jump onto square 1, and hey, we’re part of the way there.

The Bit That Knows Where To Get Stuff from Memory could, if we let it, always point at 0, which would not be much use, because the computer would never leave square 1 on the hopscotch grid. So, each time a hopscotch code is executed, the Bit That Knows Where To Get Stuff from Memory skips on 1. So now, it’s pointing at 1, and at address 1, we have hopscotch code 3. So, you could call the Bit That Knows Where To Get Stuff from Memory the Bit that Points at the Right Instruction. Actually, it’s called the Instruction Pointer or Program Counter. And the Bit That Does Stuff together with the Bit That Knows Where To Get Stuff from Memory are called the “central processing unit”, CPU.
There’s just a last bit of information that you need to know and that is How does the Bit That Knows Where To Get Stuff from Memory actually get the stuff from memory? This is a very good question.

There are two links between the Bit That Knows Where To Get Stuff from Memory and the memory. They are called buses and they work a bit like real buses. One is the “address bus” and the other is the “data bus”. So the Bit That Knows Where To Get Stuff from Memory sends the address it wants to get information from down the address bus and the data at that address comes back on the data bus. It really is that simple.
This is how a computer works. There isn’t really any magic there, is there, now that you’ve seen it. No need to
wave a magic wand and cry “Abracadabra”

________________________________________________

Some Notes:

  1. Harry Potter is a JK Rowling character, as are Ron Weasley and his mother. A Muggle is a member of the nonmagical community, someone who cannot do magic.
  2. Star Wars is a trademark of LucasFilms. The Star Destroyer is a battle ship of the Empire, namely the bad guys.
  3. There are various ways to play hopscotch. I used the rules taught to me by my five year old niece.
  4. Calvin and Hobbes are a six year old boy with a terrific imagination and a very rudimentary knowledge of
    science and his pet (or toy, depending on your viewpoint) tiger.

_____________________________________

this was written by me, Treasa Lynch for a college gig about 5 years ago. If you think you’d find it useful, please…off you go. If you’re going to post it around the internet, all I really want is that you link back to this page. If you want to reprint it anywhere, please leave a comment.

_____________________________________

I’d like kids to be as computer literate as they are tv remote literate.

_____________________________________

This is my contribution (s0 far) to Ireland’s Smart Economy. I will look at designing a printable kid’s version if there’s enough interest.

{ 6 } Comments

  1. Kevin | 27/04/2010 at 12:00 am | Permalink

    I’m exhausted after reading that. Still its very useful for explaining the basics to kids.

  2. windsandbreezes | 27/04/2010 at 12:06 pm | Permalink

    I know. You should have seen me after reformatting it for the web yesterday evening. Thought I’d never reach the bit at the end.

    But if it’s useful for explaining the basics, then it’ll have been worth it.

  3. TUG | 29/04/2010 at 3:47 pm | Permalink

    Maybe some xkcd and scary go round illustrations would help it out!

    If you emailed John Allison, I’d imagine he’d look favourably on reproducing this beauty alongside it!

    http://scarygoround.com/sgr/ar.php?date=20060911

  4. windsandbreezes | 29/04/2010 at 7:26 pm | Permalink

    That’s a point. I may give that a shot. I wanted to include one of the Calvin and Hobbes transmogrifier thingies but I don’t believe he’s/they are quite as…amenable to stuff like that.

    could be wrong though.

    I might email John Allison though although I think the target of that is not the target demographic of sub 5 year olds that this is aimed at.

  5. TUG | 30/04/2010 at 9:53 am | Permalink

    Yep but it’ll amuse the adults who browse it and subconsciously raise the level of intellectualism of the kids…

    Evil but that’s who we need to work… By osmosis!!

  6. TUG | 30/04/2010 at 9:54 am | Permalink

    Who? How?

    Shouldn’t have had that pitcher of Staropramen last night!

Post a Comment

Your email is never published nor shared. Required fields are marked *