I find myself trying to explain what memory (as it corresponds to computers) is. A lot of people have a hard time understanding what R.A.M. is and the difference between it and hard drive space. Well, listening to a news story a few months ago about the 2007 LA Marathon winner, Kenyan Fred Mogaka, I came up with an unlikely analogy.

The Slow Librarian, the Marathon Winner, and You

You’re standing in a large room (imagine a school gymnasium). You’re here to do research about computer memory. Your desk is near the entrance. It is one of those small school desks and you only have room on it for a couple of books at a time.

On the wall opposite the entrance (farthest from you) there is a giant bookshelf on which there is every book on computer systems you can imagine. The books are indexed and it would be possible for you to browse through the stacks and find what you need but this would take an unacceptably long time.

Instead you’ll rely on the highly skilled librarian who’s been hired specially to find books on this giant bookshelf. This librarian has a printed index of all books on the shelf, cross-referenced to their location. He also has a ladder, a book bag, and more importantly, experience. He’s practically made to retrieve books from this particular bookshelf.

When you ask for a book from this librarian he can find it relatively quickly (compared to you). However, if the books you ask for are far apart, split into volumes, or very very large (think unabridged dictionary) it will slow him down. He can carry a substantial but still limited amount of books at a time.

You might think you’re set. You request the books you want and the librarian brings them to you. But the room you’re in is very large and the librarian would take a long time to cross it. The same goes for you. You need a faster solution.

As it so happens, you met 2007 L.A. Marathon winner Fred Mogaka the day before and he’s agreed to help you today. Being a marathon runner, he is both fast and reliable. He’ll have no problem running across the room getting books for you. He can’t carry nearly as many books as the librarian but he makes up for that in speed.

This is how your system works: you ask Fred for the books you want. He runs across the room to the librarian. The librarian quickly looks up your books in his index and retrieves the books as fast as he can. Fred grabs all the books he can and runs back to your desk. He stands there with the books, handing you only the ones you need since you have limited desk space.


First, the obvious:

  1. The librarian and bookshelf is the hard drive of this “modern computer”. It hold a vast amount of information but is slow at retrieving it; too slow to be practical for your fast-paced research. The bookshelf can store those books indefinitely as well but waiting five minutes while the librarian gets back with a book each time you need to look something up is inefficient.
  2. Fred, the marathon runner, is the Random Access Memory (RAM). He’s fast and can give you any book he is currently carrying immediately since he doesn’t have to look through a bag like the librarian. The downside is that he can’t carry many books and at the end of the day he goes home—the books he was carrying have to be put back on the bookshelf or they will be lost.
  3. You, the researcher, are the processor (CPU/Computer Processing Unit). You take the information out and process it in some way, whether that means taking notes, writing abstracts, or writing new material. Your small desk, which holds the books you know you’re going to need immediately, is the processor cache.

So far this system is read-only—you’re not sending anything back to the bookshelf. Well, all this research you’ve been doing has inspired you to write a book full of easy to understand computer analogies. You’re going to want to store all those pages you write but you know that Fred will only carry them until the end of the day, so we have to file them on the bookshelf.

You hand the pages you write to Fred and when you’re sure you don’t need them anymore, he hands them to the librarian to file for later.

We might run into a problem if we start requesting many books and sending back many pages: Fred can only carry so many books and pages at a time. If you need additional books he has to return to the bookshelf and file some of the ones he is carrying before he can carry more. What if you need those particular books or pages again, perhaps to review a concept you missed? The whole process has to be carried out again; with Fred running back and having the librarian pull the books from the shelf. There is a better solution called virtual memory (or swap space).

The librarian has set up a desk especially for Fred. It’s one of those expandable desks—you can pull out the sides for additional space. Since Fred is so fast he can pretend to be able to carry more books than he actually can. He places the books that he thinks you might need again or will need soon on this desk. When you ask for those books he can retrieve them relatively faster than going through the librarian to access the bookshelf.


I don’t want to wear this analogy thin (perhaps I already did) but there are some additional analogues we can make.

  1. The librarian is like the read/write head of the computer hard drive, reading and writing data to the platter. The bookshelf is a platter, actually storing the data. Hard drives can have many platters (bookshelf’s) and usually one head (librarians) per platter.
  2. I said that requesting books that are split into volumes, very large, or very far apart can slow down the librarian. Books which are split into volumes are fragmented. This also happens to data on a hard drive. A file is split onto different areas of the drive and the head/librarian must run around to get the whole thing.
  3. You can see why adding another Fred to the system would speed it up immensely. You would have less need for virtual memory and could hold more books at a time near you, where you have almost instant access to them. Adding another you would help, so long as the work you’re doing can be split up (you and you’re partner would be dual processors. If you had a Siamese twin you’d be a dual-core processor.). The thing is Fred works for free (or cheaply) since he loves to run. Hiring another you would be expensive. So too is RAM the cheapest solution to making a computer “faster”.

I’ll be posting additional analogies in the next 28 days. If you have something you’d like explained just leave a comment.

This post (3/30) is part of 30 Days - Stories and Thoughts, June 21 - July 20, '07 at nickspeaks.com