6. Cache - Levels

Having a single cache on the CPU side is an excellent way to improve performance. But this technique can be extended even further by arranging a hierarchy (layers) of caches within the CPU chip, each one a bit faster than the one feeding it.

cache hierarchy

The cache closest to the CPU cores has to be the fastest, this is a Level 1 cache. The Level 1 cache (fast but small) is being serviced by a Level 2 cache (slower but larger) and so on. The idea is to match the speed of instruction and data flow to the speed of the CPU to maximise performance.

There is no perfect cache design, as there are compromises. And so each CPU maker has its own ideas of the best arrangement.

The next page gives some examples of cache arrangements.

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Code optimisation with cache

 

Copyright © www.teach-ict.com