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.

Cache memory acts as a staging ground to store data that will be needed by the processor in the immediate future. Most computers have more than one cache, these levels vary in size and speed. The cache can prevent bottlenecks between the processor and the main memory (RAM) by storing copies of the most frequently used data.

Main memory is further removed from the processor. It is larger and slower than the cache and stores the data and instructions the processor is currently working on. The main memory can only hold information while it has power, it is a temporary memory location.

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 four different areas where data is stored; that is, four different kinds of memory. These are disk, main memory (also known as random access memory or RAM), cache memory, and registers.

Click Next when you’re ready to move on to the next exercise.

Take this course for free

Mini Info Outline Icon
By signing up for Codecademy, you agree to Codecademy's Terms of Service & Privacy Policy.

Or sign up using:

Already have an account?