Sunday, May 24, 2009

HDD vs. RAM

Taken From: http://www.sysopt.com/forum/archive/index.php/t-100678.html

You are in a classroom. The teacher has a filing cabinet, a desk, and a black board.

The teacher's filing cabinet is used to store all of her files. She keeps records of her students, her teaching books and answer keys. If it is important, and she doesn't want to lose it, this is where she puts it. All the papers are separated by folders, and labelled so she can find them quickly. There is a limited amount of space in her filing cabinet, though. She still has enough room, but it is getting a little tight, so she needs to occasionally go through and get rid of things she no longer uses or needs (disk cleanup).
To help her find things faster, she also occasionally moves files back into the right order, because she's always in a hurry and puts things back in the first available spot (defrag). The filing cabinet, BTW, is about 15 feet from where she stands.

The teacher's desk is where she puts the files that she has pulled from the filing cabinet. She has an extremely small desk, so it can only hold one document at a time, so sometimes she uses the top of the filing cabinet for a little extra room for a couple more files that she's using. The desk simply holds the file so that she can copy it onto the blackboard. She cleans off the desk often. Everytime she needs to use a different file, she puts the old one back in the filing cabinet and replaces it with the new file. If she knows she's going to use it again, she'll put it on top of the filing cabinet.

As she's teaching, the blackboard can get quite full. If she wants to save what's written, she must copy it to a blank sheet of paper and put it into the filing cabinet. She can erase a portion of it if she wants, too. This will make enough space for her to work on something else. She draws lines to separate what she is working on.
If, at the end of the day there is anything left on the chalkboard, the janitor will come and erase it, so it's important that she copies it down.
Also, if the school closes for whatever reason, the janitor will rush in, and clean the chalkboard so he can get home as fast as possible. If this happens, the teacher has lost any notes she didn't copy down and put into the filing cabinet.

KEY:
Filing Cabinet = Hard drive
Top of filing cabinet = Swap file (virtual RAM on HDD)
Desk = Cache
Blackboard = RAM
Teacher = Processor
Janitor = Loss of power (shut down system or failure)

This post is partially correct, as no analogy can FULLY explain exactly what happens when processing data. It is meant as a simple way to explain to someone how the HDD/RAM/CACHE/SWAP FILE system works.

No comments: