Skip to main content
Engineering LibreTexts

1.7.1 Cache Memory - Multilevel Cache

  • Page ID
  • Multilevel Cache

    Multilevel cache is one of the techniques to improve cache performance by reducing the miss penalty. The term miss penalty refers to the extra time required to bring the data into cache from the main memory whenever there is a miss in cache .

    For clear understanding let us consider an example where CPU requires 10 memory references for accessing the desired information and consider this scenario in the following 3 cases of System design :

    System Design without cache memory

    Here the CPU directly communicates with the main memory and no caches are involved.
    In this case, the CPU needs to access the main memory 10 times to access the desired information.

    System Design with cache memory


    Here the CPU at first checks whether the desired data is present in the cache memory or not i.e. whether there is a “hit” in cache or “miss” in cache. Suppose there are 3 miss in cache memory then the main memory will be accessed only 3 times. We can see that here the miss penalty is reduced because the main memory is accessed a lesser number of times than that in the previous case.

    System Design with Multilevel cache memory

    Here the cache performance is optimized further by introducing multilevel Caches. As shown in the above figure, we are considering 2 level cache Design. Suppose there are 3 miss in the L1 cache memory and out of these 3 misses there are 2 miss in the L2 cache memory then the Main Memory will be accessed only 2 times. It is clear that here the miss penalty is reduced considerably than that in the previous case thereby improving the performance of cache memory.

    NOTE :
    We can observe from the above 3 cases that we are trying to decrease the number of main memory references and thus decreasing the miss penalty in order to improve the overall system performance. Also, it is important to note that in the multilevel cache design, L1 cache is attached to the CPU and it is small in size but fast. Although, L2 cache is attached to the primary cache i.e. L1 cache and it is larger in size and slower but still faster than the main memory.

    Effective Access Time = Hit rate * Cache access time
                          + Miss rate * Lower level access time

    Average access Time For Multilevel Cache:(Tavg)

    Tavg = H1 * C1 + (1 – H1) * (H2 * C2 +(1 – H2) *M )

    H1 is the Hit rate in the L1 caches.
    H2 is the Hit rate in the L2 cache.
    C1 is the Time to access information in the L1 caches.
    C2 is the Miss penalty to transfer information from the L2 cache to an L1 cache.
    M is the Miss penalty to transfer information from the main memory to the L2 cache.

    Adapted from:
    "Multilevel Cache Organisation" by shreya garg 4Geeks for Geeks is licensed under CC BY-SA 4.0

    • Was this article helpful?