|The Memory Principle - Computer Memory and Pigeonholes|
|Written by Mike James|
|Thursday, 07 January 2021|
Page 3 of 3
I admit that we have got rid of the pigeons but the push rods are still there! In this case the push rods are digital signals that come out of the CPU’s electronics – to find out exactly how it works and some fascinating facts like why a Megabyte is exactly 1,048,576 bytes see How Memory Works.
Modern memory - no push rods and certainly no pigeons
Make your own memory
There is a well-known demonstration of how computer memory works that isn’t as well known today as it used to be. It is an excellent demonstration and it’s fun so find yourself sixteen postcards or similar, a hole punch, a pair of scissors and some knitting needles..
Take your set of postcards and punch four holes in a row close to the top edge of each one. The holes have to line up so you can see through them all when you make a stack of the cards. If you are strong enough and have a good enough punch the easiest way of doing this is to punch all sixteen in one go. Next you have to number each card in binary writing the bits under each hole.
Take a pair of scissors and turn any hole with a zero below it into a U shaped slot (see the diagrams for clarification).
First punch holes in all 16 cards (only four shown)
Number the cards in binary and make each zero hole into a slot.
When you put the pack of cards back together you have a working computer memory.
If you don’t believe me I will now tell you how to automatically access a location. Shuffle the cards, because the selection process doesn’t depend on them being in any particular order.
Suppose you want the card corresponding to address 1010.
First take a pair of knitting needles and place them in the first and third holes counting from the right - i.e. the holes corresponding to the positions you want a zero in.
Now lift up the needles together and the cards left behind have to have zeros i.e. slots in both of those positions.
That is the cards that are left behind all have addresses like x0x0 where x is zero or one.
With this subset of cards repeat the procedure but now place a single needle in the fourth position from the right and lift out a subset of cards. These now correspond to the address 10x0 and so finally you can put the needle through the second position from the left and lift out the only card with the address 1010.
This is a completely general procedure and any card that you are looking for can be found in the same way. First use multiple needles to pull out cards with the required zeros and then use a single needle to reduce the deck to the cards with the required ones.
There is also a very simple procedure that can be used to put a shuffled deck of binary cards back into order - can you work out what it is?
Your next project is to automate this procedure using Lego or Meccano and build something that works as fast as a multicore processor!
The memory principle is that you store data at an address for later retrieval and presenting the address to the mechanism automatically retrieves the correct data. In other words the address physically selects the data returned it isn't just a passive label.
What Programmers Know
* Recently revised
Summer SALE Kindle 9.99 Paperback $10 off!!
or email your comment to: firstname.lastname@example.org
|Last Updated ( Thursday, 07 January 2021 )|