The Memory Principle - Computer Memory and Pigeonholes
Written by Mike James   
Thursday, 07 January 2021
Article Index
The Memory Principle - Computer Memory and Pigeonholes
The Principle
Modern Computers

Modern Computers

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. 


Related Articles

How Memory Works

Cache Memory 


Charles Babbage

Virtual Memory

Flash Memory - Changing Storage


Processor Design - RISC,CISC & ROPS



What Programmers Know



  1. The Computer - What's The Big Idea?*
  2. The Memory Principle - Computer Memory and Pigeonholes*
  3. Principles of Execution - The CPU
  4. The Essence Of Programming
  5. Variables - Scope, Lifetime And More*
  6. Binary Arithmetic
  7. Hexadecimal*
  8. Binary - Negative Numbers*
  9. Floating Point Numbers*
  10. Inside the Computer - Addressing
  11. The Mod Function
  12. Recursion
  13. The Lost Art Of The Storage Mapping Function *
  14. Hashing - The Greatest Idea In Programming
  15. Advanced Hashing
  16. XOR - The Magic Swap*
  17. Programmer's Introduction to XML
  18. From Data To Objects*
  19. What Exactly Is A First Class Function - And Why You Should Care*
  20. Stacks And Trees*
  21. The LIFO Stack - A Gentle Guide*
  22. Data Structures - Trees
  23. Inside Random Numbers
  24. The Monte Carlo Method
  25. Cache Memory And The Caching Principle
  26. Data Compression The Dictionary Way
  27. Dates Are Difficult*
  28. Sequential Storage*
  29. Magic of Merging*
  30. Power of Operators
  31. The Heart Of A Compiler*
  32. The Fundamentals of Pointers
  33. Functional And Dysfunctional Programming*

* Recently revised

Summer SALE Kindle 9.99 Paperback $10 off!!




or email your comment to:

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.


Programmer's Guide To Theory - Error Correction

Error correcting codes are essential to computing and all sorts of communications. At first they seem a bit like magic. How can you possibly not only detect an error but correct it as well? How do the [ ... ]

Floating Point Numbers

Inconvenient though they may be, fractions are the real stuff of numbers and to work with them we need to know about floating point numbers ...

Other Articles

Last Updated ( Thursday, 07 January 2021 )