For inclusion to hold between two cache levels L1 and L2 in a multi-level…

2008

For inclusion to hold between two cache levels L1 and L2 in a multi-level cache hierarchy, which of the following are necessary?

I. L1 must be a write-through cache
II. L2 must be a write-through cache
III. The associativity of L2 must be greater than that of L1
IV. The L2 cache must be at least as large as the L1 cache 

  1. A.

    IV only

  2. B.

    I and IV only

  3. C.

    I, III and IV only

  4. D.

    I, II, III and IV

Attempted by 97 students.

Show answer & explanation

Correct answer: A

Correct answer: L2 must be at least as large as L1 (IV only).

Explanation: Inclusion means every cache line present in the L1 cache must also be present in the L2 cache. To guarantee that, L2 needs sufficient capacity to hold all lines that can reside in L1.

  • Why L2 size is necessary: If L2 is smaller than L1, there will not be space to hold every L1 line, so inclusion cannot hold.

  • Why L1 being write-through is not required: A write-back L1 can still maintain inclusion if the cache controller writes or moves evicted lines into L2 (or otherwise ensures L2 contains the line).

  • Why L2 being write-through is not required: The write policy of L2 (write-through vs write-back) does not by itself determine whether inclusion holds; inclusion concerns presence of lines, not where writes propagate.

  • Why greater associativity in L2 is not strictly necessary: Higher associativity in L2 can make maintaining inclusion simpler, but inclusion can be preserved with equal or different associativities using appropriate placement and eviction mechanisms. Therefore strictly requiring L2 associativity to exceed L1 is not a formal necessity.

Implementation note: Designers often choose L2 to be larger (and sometimes at least as associative) and use eviction/coherence policies that simplify enforcing inclusion, but these are engineering choices rather than additional logical requirements beyond L2's capacity to hold all L1 lines.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir