Options  |  About
Cache

If you have gone through the CPU section, you may already be familiar with the computer's Cache. A very important part of both the CPU and the whole computer, it is the fastest type of memory available to our computer. On the downside, it is very expensive to make, so not many CPUs have a large amount of it. You will soon learn how this small amount available to our computer greatly improves the performance.


This is 1/4 MB of Cache from the Intel Pentium III Processor
© 2001 by Intel Corp.



A Real Life Example

To demonstrate how Cache is used, I will once again use Jessica, the very efficient high school student.

When Jessica is at a particular class, we already know that she always brings the required equipment and books. We also know that Jessica may not always be using all of her textbooks and notebooks at the same time. To make things more organized, she would have the things she does not need right away inside her desk. In the same way, the computer stores the things it does not need, but will need soon, in the Ram. If Jessica is writing a note that her teacher is dictating to the class, she would have a notebook as well as her writing equipment out. She would have a pencil in her hand because this is what she would use the most. On her desk, she would have other writing utensils such as an eraser, highlighter, ruler, etc. There is no point in constantly keeping these in her hand because she only requires it from time to time. She keeps them on the desk, because she does require it more than the equipment in her desk.

Much like Jessica's desktop and hand, the Cache is used to store the things that are needed the most by the CPU. Level 1 Cache, like her hand, is used to store the data that will be needed the most by the CPU. The L1 Cache is very expensive to make, so only a small amount of it is available.

The desktop, which has all of the equipment Jessica will need from time to time was used to represent Level 2 Cache. It stores more data that the CPU will need frequently, but not as frequently as the data stored in the L1 Cache. L2 Cache is similar to L1 Cache, except that it is slower and less expensive to make. There is usually much more L2 Cache than L1 cache for these reasons.

If the information needed is not in the Cache, the computer looks in the RAM, and if it not available there, it takes it from permanent storage (usually the hard drive).

To demonstrate the above in a visual manner, here is a Pyramid representing the different levels of memory, and when they are accessed.

Full Screen

As you can see, the CPU tries to see if the data it requires is in the L1 or L2 Cache. If it is not, it has no choice but to go to the slower RAM. In the case that the data it needs is not in either of these types of memory, it has to access them from permanent storage types, such as a CD-ROM Drive, or a Hard Drive.



Type of Data Stored in the Cache

What type of data would need to be accessed over and over again? Well, this can vary depending on the program used. For example, in a Word Processor, the font that is currently used may be stored in the cache because it has to be accessed every time the user inputs any letter or number. In programming, loops are used very commonly. Loops let the computer know that it has to execute a block of code a certain number of times, which can be anywhere from two to thousands of times. You can see how much time the computer would save by not having to go to the much slower RAM thousands of times just to complete one block of code.

Back Forward
Back Forward

Gates of Creation // Memory // Cache