Previous | Next --- Slide 19 of 23
Back to Lecture Thumbnails
iZac

What happens when L1 cache wants to flush a line and that particular line does not exist in L2. Does it first allocate the line in L2 and then proceed to flush (writeback)?

jazzbass

@iZac I think that L1 is only responsible to making the write on the memory storage immediately above it (in this case, L2). L2 handles the L1's write request as any other write request, it may need to evict other cache line to serve the request. Now, if L2 is a write-through cache, it will make a write to the next memory hierarchy immediately (perhaps it is main memory now), but if L2 is a write-back cache, it will not write L1's write to main memory until the line is evicted from L2.

uncreative

This discussion of how the elements in the L2 cache are not automatically included in the L1 cache made me wonder about how cache replacement policies would change if the L1 was not necessarily included in the L2. Evidently in exclusive caches, you end up swapping an element in L1 with an element in L2 on a L1 miss which is an L2 hit.

I thought the discussion on wikipedia was interesting:

http://en.wikipedia.org/wiki/CPU_cache#Exclusive_versus_inclusive

andymochi

I thought it might be interesting to see if the set associativities could also violate inclusion without differing access histories. Turns out that the answer is no, it can't happen, because the number of sets is always a power of 2.