The term memory is a catch-all for what is actually a highly diverse set of places where information is stored. These places differ in two fundamental respects: size and speed. The general rule of thumb is this: the faster the memory the less of it we have to work with.
Registers are the closest form of memory to the processor. For that reason, they are the fastest. But they also store the least amount of information. A computer’s registers contain the actual values the processor does calculations with. Executing a line of code like
x = x + 1 entails fetching the current value of
x from wherever it exists in memory, putting it into a register, and adding
1 to it.
Main memory is further removed from the processor. It exists as a staging ground for information that, at some point, the processor may need to use but which is not yet needed.
Finally, there is disk. Think of disk as a form of deep storage, like a box collecting dust in the closet. Disk is where we can store the largest amount of information. But it is also the slowest. Much like retrieving files from the closet, retrieving information from disk is more involved and, for that reason, slower than retrieving information from locations closer to the processor.
The illustration to the right shows three different areas where data is stored; that is, three different kinds of memory. These are disk, main memory (also known as random access memory or RAM), and registers.
Click Next when you’re ready to move on to the next exercise.