retagged by
38,946 views
89 89 votes

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

  1. $L_1$ must be write-through cache

  2. $L_2$ must be a write-through cache

  3. The associativity of $L_2$ must be greater than that of $L_1$

  4. The $L_2$ cache must be at least as large as the $L_1$ cache

  1. IV only
  2. I and IV only
  3. I, II and IV only
  4. I, II, III and IV

6 Answers

Best answer
70 70 votes

1$^{\text{st}}$ is not correct as data need not to be exactly same at the same point of time and so write back policy can be used in this.

2$^{\text{nd}}$ is not needed when talking only about $L1$ and $L2$.

For 3$^{\text{rd}}$, associativity can be equal.

So, only 4$^{\text{th}}$ statement is Necessarily true - (A) choice.

edited by
50 50 votes

Cache levels differs only because their access times are different. If $L_1$ is made write through then it implies that on every write operation it will take the same time that $L_2$ cache takes to write. so this will erase the difference between $L_1$ and $L_2$ and to use them at different levels will be implied as meaningless. So, statement I cannot be true always.

statement II asks that $L_2$ is always write through, this is not true for every case we can have a Write Back cache in many cases. So, this is also false.

statement III talks nothing meaningful. as assoc. has nothing to do here.

statement IV : for Inclusion property to hold it is required that $L_1$ is a subset of $L_2$ cache. 

Hence, answer = option A

edited by
7 7 votes

Inclusion in a multi level hierarchy refers to a property where all the dara Stored in a higher level (smaller, faster) cache like L1 iis present in the lower level (larger, smaller) cache line L2.Essentially if a data block exist in the L1 cache, the same data block exists in the L2 cache.This ensures that when an eviction happens in L2. the corresponding data is also evicted from L1 to maintain consistency

Option I: L1 must be write Through: This is not necessary for inclusion to hold

  • Inclusion can also hold in a write back cache. 
  • Write Thaough cache ensures that whenever data is written to L1 ,it is immediately written to L2 as well, but inclusion can still hold even if L1 is a write-back cache (which only writes to L2 when data is evicted from L2)

So L1 must be write through is not necessary.

Option II::L2 must be write Through

. Same reasoning  as above.

Option C:The associativity of 12 must be greater than that of Li

  • .Not neccessarly True
  • Generally desirable for performance issues
  • Greater associativity in L2 helps avoid conflict that might evict lines prematurely improving cache performance through inclusion can hold without  this.

This option is not necessarily true

Option IV:The L2 cache must be at least as large as the L1 cache

  • This is necessary for inclusion to hold
  • If L2 i smaller than L1,there wouldnot be enough space in L2 to store all the data from L1,breaking inclusion property.

 

 

2 2 votes

Why option 1 and 2 are correct

If the the caches are not write through, we can have a imbalance between the LRU counter in the L1 and L2 caches. leading to a situation where the inclusion property will fail eventually. Hence every HIT in L1, must propogate to L2 also, in order to maintain consistency in the LRU counter.

The video given below displays a good example of this problem, when write through cache are not used.

https://www.youtube.com/watch?v=J8DQG9Pvp3U

Why option 4 is also correct

The size of L1 and L2 caches can be equal, or L2 can be greater. 

case 1 (If they are equal or L2 is greater): This part is quiet self explanatory, in this case we are sure to have atleast as many entries in L1 as L2, also L2 can have extra lines which does not affect our inclusion property.

case 2 (If L1 is greater than L2): Lets say L1=10 lines and L2=2 lines, if block 0, 1 are accessed, they lead to compulsary misses and are now available in L1 as well as L2.

Now lets say we access 3, 

in L2 cache, we must have it replace atleast one out of 0, 1, and due to greater size of L1 we may not necessarily map 3 to existing position, when this occurs we will have violated our inclusion property.

Hence I believe the answer to be (c)

Hello Everyone, this is my very first post, so i'm sorry If my explanation is not explained as well as it should be.

1 flag:
✌ Edit necessary (Krish_Vg “Wrong answer”)
2 2 votes

OK so first we have to know what is Inclusion 

Inclusion means every cache line present in L1 must also be present in L2

Now lets dive into options,

  • If L2 is not large enough to hold all lines that can be resident in L1, inclusion is impossible. So IV is a necessary condition. 

  • I and II (write-through requirements) are not strictly necessary — inclusion can be maintained with write-back caches if the controller handles writebacks correctly (e.g., writeback from L1 into L2 on eviction).

  • III (L2 associativity > L1 associativity) is helpful to avoid conflict-induced violations, but it's not strictly necessary — inclusion can be enforced through eviction/invalidations or other design mechanisms.

Answer:
Position:
Show:

Related questions

74 74 votes
4 answers 4 answers
35.3k
35.3k views
Kathleen asked Sep 12, 2014
35,349 views
Which of the following are NOT true in a pipelined processor?Bypassing can handle all RAW hazardsRegister renaming can eliminate all register carried WAR hazardsControl h...
47 47 votes
7 answers 7 answers
15.6k
15.6k views
go_editor asked Apr 23, 2016
15,614 views
Consider a machine with a $2$-way set associative data cache of size $64$ Kbytes and block size $16$ bytes. The cache is managed using $32$ bit virtual addresses and the ...
84 84 votes
10 answers 10 answers
28.7k
28.7k views
go_editor asked Apr 23, 2016
28,677 views
Consider a machine with a $2$-way set associative data cache of size $64$ Kbytes and block size $16$ bytes. The cache is managed using $32$ bit virtual addresses and the ...
76 76 votes
5 answers 5 answers
30.3k
30.3k views
Kathleen asked Sep 12, 2014
30,277 views
Consider a machine with a $2$-way set associative data cache of size $64\text{Kbytes}$ and block size $16\text{bytes}$. The cache is managed using $32\;\text{bit}$ virtua...