Computers Are Liars - Part 1 - Virual Memory And Eambezzlement

time to read 4 min | 797 words

Had you ever had to explain some technicality about the inner working of your computer to a non-technical person?
Did you manage to make the other person grok what is actually happenning?
I'm trying to educate my little brother on how computers work, this is the result:

[Warning: The following conversation was taken while driving to a movie late at night, and in a different lanauge.]

Brother: What is Virtual Memory and why is it low {refering to an error message he got earlier}? I've a lot of memory in my computer. You just installed another 10GB!

Ayende: No, I installed a HD, not memory.

Brother: What is the difference?

Ayende: Well, it's like having a whiteboard and a dossier. You can write anything on the whiteboard, and you can see everything at one, but eventually you'll run out of room. With a dossier, you can put as much information as you want {at least until the dossier cracks} but it takes a lot of time to search for something. The difference is how much time it takes to read or write something, and how much information it can hold.

Borther: So, which is which?

Ayende: Your computer memory is is like a whiteboard, very easy to write or read, but limited in space. And can be deleted very easily. A HD is much larger, and it takes more time to read and write to it, just like a dossier.

Borther: So what is virtual memory? A divider in the dossier?

[Now it gets interesting]
Ayende: Well, no. The problem is that... that... {A this point I give up and decide to personify the computer}. The computer is like a bank clerk, and any program that you run is a client. The bank don't have a lot of money available, most of it is invested elsewhere. But when a program wants more memory {a client walks to the cashier and ask to withdraw} the computer gives it the memory. The problem is when there are too many request and the money run out.

Brother: What happens then? Does the computer tell it to come tomorrow?

Ayende: The computer is too nice a person to tell you to "Go away, we don't have any more memory! Sue us!"

Brother: But what actually happens?

Ayende: Well, the computer lies. It tells you, no problem, here is the check, just cash it in when you need. You see, it hopes that you want cash it in until some other customer make a deposit {a program releases memory}.

Brother: And what happens when you do use it before it has enough?

Ayende: Well, then it cheats. First, it looks into other accounts and find what funds {places in memory} are not likely to be used soon, then it embezzle the memory away and give it to the application that wants it.

Brother: And when the embezzled application wants that memory?

Ayende: Well, the computers lies again, it again find some place unlikely to be used soon, and give the application that place.

Brother: Sound like it would get caught sometime, because what if a lot of application suddenly wants their memory back at the same time? It would have to tell some of them that it doesn't have any.

Ayende: No, that would be rude. It just politely ask them to stand in line, and steals from any of them to satisfy the requests that they need.

Brother: And won't any of them notice that they were robbed?

Ayende: No, applications don't have wallets, so the only way to can get the money is through the cashier, and he is lying through his teeth to convince them that the bank has all the money in the world {or at least about 4 Billions of it}.

Brother: I didn't know that computers lied to each other as well.

Ayende: They do, all the time.

Brother: But it nobody notice that the computer is a liar, why I got this message about low Virtual Memory?

Ayende: Oh, now you are talking about swap...

[To be (hopefully) continued...]