Notes Home

CA644, System Software
Table of Contents

What is a Computer?

CA644, System Software

Dr. Niall McMahon

2022-09-13

If you print these slides, think about using two pages per sheet (although don't worry too much about it).

A (Kind of) Parable

  • This is a re-telling of Richard Feynman's excellent lecture about how a computer works.
  • Here, a computer means the important bit, the Central Processing Unit.
  • You can find Feynman's lecture here.

Setting the Scene

  • Imagine we are back in time before modern computers.
  • Information is stored in paper files, in filing cabinets.
  • It is the job of a filing clerk to retrieve paper files and to extract information.

The Filing Clerk

  • They work for a company that has salespeople.
  • The salespeople are paid commission, i.e. their pay depends on the sales they make.
  • It's the filing clerk's job to calculate each salesperson's commission every quarter.

Job Description

  • In one of the filing cabinets, there are cards, one for each salesperson.
  • Each card has the salesperson's name, their sales commission rate, their sales this quarter.
  • The clerk calculates the commission by multiplying the commission rate by the sales.

The Job Process

The actions taken are:

  • Taking cards from places.
  • Looking at information.
  • Doing something with the information, writing it down somewhere and carrying out a multiplication.
  • Putting cards back.

The Job Process

Of course, the clerk might do other things, e.g. calculate the total amount owed to all salespeople for the last quarter. In this case, the clerk would:

  • Read all the cards and keep a running total of the calculated amount.
  • Start with a total of zero euro, updating after each salesperson's card is checked.

What is a Computer? › A (Kind of) Parable ›

A Faster Clerk

  • The boss wonders if the process can be improved.
  • The clerk is good but not so fast.

Version 2.0

  • The company finds a new clerk who is 5 times faster!
  • The trouble is that they can't multiply.
  • No problem! The new clerk is given a filing cabinet full of multiplication tables.
  • There's a bit of set-up at the start but it's faster overall.

Faster but Stupider

  • The new clerk can find the answer to any multiplication in this file.
  • The new clerk - who can't multiply - can go to the multiplication cabinet.
  • Say they need to multiply 3 and 7.
  • They find the card that's called "3 x 7" and on it will be written "21".
  • The cards will have all the possible multiplications that the new clerk will need.

Multiplication is a Look-Up

So for the multiplication step, this new clerk goes to the file instead of doing the arithmetic. And even though this takes longer than doing the arithmetic, and there's some set-up, the new clerk is still a good deal faster overall than the original.

An Even Faster Clerk

  • Again, the boss wonders if the process can be improved.
  • The new clerk is good but maybe could be faster.

Version 3.0

  • The company finds a new clerk who is 10 times faster again!
  • The trouble is that they can't add or multiply or do any arithmetic, almost.
  • No problem! The new clerk is given a a cabinet of additions to go with the multiplications.
  • There's set-up at the start but it's amazingly fast overall.

Version 4.0

  • The company finds a new clerk who is many times faster again!
  • The trouble is that they can't do anything except follow a single instruction at a time.
  • No problem! The new clerk is given a a cabinet of instructions in order.
  • When a request arrives, the clerk takes one instruction card after another until the job is done.
  • All the clerk has to do is to keep track of the instructions, what the next card will be.
  • There's a lot of set-up at the start but it's blisteringly fast overall.

Version 5.0

  • The company finds a new clerk who is many times faster again!
  • The trouble is that they can't keep track of instructions.
  • They can do one thing: they can add one to a number. So, beginning at zero, they can count upwards.
  • So, no problem! This new clerk will be given numbered instructions.
  • The clerk takes instruction 0 out of the file and carries out the actions.
  • After completing this, the clerk increments the instruction count by 1 and takes out the corresponding card.
  • At this point, the filing system is very, very fast but the clerk is very, very stupid.

Version 6.0

  • The company finds a new clerk who is very many times faster again!
  • The trouble is that they can't read.
  • They can tell two things apart.

Identifying Cabinets

Imagine that all the files are contained in just 8 cabinets and we want to give each cabinet a unique name using only two colours. Well, you could do something like this; first of all divide the cabinets into two groups and assign one group one colour and the other the second colour:

Cabinet 1 Cabinet 2 Cabinet 3 Cabinet 4 Cabinet 5 Cabinet 6 Cabinet 7 Cabinet 8
0 0 0 0 1 1 1 1

And then divide each of the two groups in two, colour coded, as before, forming a second layer:

Cabinet 1 Cabinet 2 Cabinet 3 Cabinet 4 Cabinet 5 Cabinet 6 Cabinet 7 Cabinet 8
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1

And finally dividing the previous groups in two until the sequence is one colour and then the other:

Cabinet 1 Cabinet 2 Cabinet 3 Cabinet 4 Cabinet 5 Cabinet 6 Cabinet 7 Cabinet 8
0 0 0 0 1 1 1 1
0 0 1 1 0 0 1 1
0 1 0 1 0 1 0 1

You can see that each cabinet now has a unique name given by three colours. Cabinet 1 is grey, grey, grey and Cabinet 8 is yellow, yellow, yellow (or maybe light grey instead yellow).

Output

  • The same system can be used to create output.
  • Remember that the clerk cannot read or write.
  • We give the clerk a screen divided into lots of squares.
  • The letter "C", for example, can be encoded with a pattern of colours.
  • If the clerk needs to make a "C", they follow the instructions.
  0     0     0     1     1     1     0     0  
  0     0     1     0     0     0     1     0  
  0     1     0     0     0     0     0     0  
  0     1     0     0     0     0     0     0  
  0     1     0     0     0     0     0     0  
  0     1     0     0     0     0     0     0  
  0     0     1     0     0     0     1     0  
  0     0     0     1     1     1     0     0  

This is very similar to a computer display.

Binary

Everything can be encoded, the files, the information on the files, using this system.

Generalising

  • Everything an be encoded this way.
  • For example, the numbers 0 - 7 can be encoded this way. And it works for all numbers; you need more layers (or colours), to identify each one uniquely.
  • 0 - 7 requires a permutation of three from the two colours. The numbers 0 - 15 requires a permutation of four. 0 - 31 requires 5. 0 - 63 requires 6. 0 - 127 requires 7 and so on. There are 128 numbers in the last range, including zero, and with two colours, you need a permutation of 7, because 27 = 128.
  0     1     2     3     4     5     6     7  
  0     0     0     0     1     1     1     1  
  0     0     1     1     0     0     1     1  
  0     1     0     1     0     1     0     1  

Improvements

  • Instead of rooms and paper files, have everything stored locally in an electronic format.
  • No walking for the clerk!
  • Or implement things mechanically or hydraulically.

Automation: AND Gates

  • Some of the automatic routing or instruction following can be implemented using something like a valve, in series, i.e. one after the other.
                          #1         #2 
                    ---> Valve ---> Valve ---> Main flow
                           |A         |B
                           |          |
                           Control flows
                

Automation: AND Gates

  • Instead of a colour, you either have a flow of water or not.
  • If water is flowing into Valve #1 at A, then it opens and allows the flow in the "main" pipe through.
  • Similarly for Valve #2.
  • If there's no flow at A, Valve #1 stays closed and the same for B and Valve #2.
  • Combinations of A and B, off/off, on/off, off/on, on/on, can be used to determine whether or not water flows through both valves and does something else.

Automation: OR Gates

  • It's the same for this configuration of valves except that if either A or B is open, then the water will flow through the main pipe.
                               #1
                        |---> Valve --->|
                        |       |A      |
                    --->|               |---> Main flow
                        |      #2       |
                        |---> Valve --->|
                                |B
                

Automating Everything

  • At this point, you'll have understood, probably, that there's no need for the file clerk at all anymore.
  • The entire filing system can be automated.

The Computer

  • Uses 1s and 0s.
  • Implemented electonically.
  • A computer is a very stupid but very fast file clerk.