Back

Cache memory

Introduction
Another type of memory is known as 'cache' and it is provided in computer systems to speed up processing.

Measuring cache
Like all memory, it is measured in bytes (or Kilobytes, Megabytes or Gigabytes). We know that programs are made up of instructions and data and these are fetched from RAM, decoded and then executed by the CPU.

Why cache helps the CPU to process data and instructions
Each instruction or piece of data fetched from RAM by the CPU takes some time to fetch and this can actually be calculated very accurately, even though it happens in billionths of seconds. Some pieces of data are needed again and again in a program. If some extra-fast storage could be provided for those pieces of data, then processing could be speeded up.

For example, when a CPU needs to repeatedly know many months there are in a year (known as a 'constant' in programming) because it has to do some calculations for lots of different years, it could read the number 12 from RAM each time it needs it. But a better way would be to store that number in its cache. Why? Because the CPU going to the cache and getting the number back is a lot faster than the CPU going to RAM and getting the number back!

We have seen in a previous section that one way to improve a computer's performance is to provide more RAM. Another way, however, is to provide more cache. The more cache you have, the more data items you can store in it and the faster the CPU can access those data items. Of course, you can't have unlimited amounts. The maximum amount you can use will depend on your motherboard.

Cache in web browsers
You will find the word 'cache' meaning 'a storage place' popping up all over the place, not just in relation to a type of memory hardware. For example, the web browser you are using to read this uses a cache to store web pages you visit. Next time you visit this page again, it will see if a copy is in its cache and display that rather than get it from the Internet, which is relatively slower. Sometimes, you may want the very latest page so you can refresh the page you are looking at. You may sometimes need to clear out the cache because it just won't display the latest pages of something. You can easily do this by clicking on the right button, but where that button is depends on your browser and version of browser. Typing into the Internet, 'How do I clear out my Explorer 11 cache?' into Google, for example, will reveal how to do this.

Back