GATE / CS ARCHIVE

SIMILAR QUESTIONS / COMPUTER ORGANIZATION & ARCHITECTURE

Evaluate dirty bits and writeback under cache policies

3 questions solved the same way, newest first. Back to Computer Organization & Architecture

How these are solved

Track whether write-through or write-back can create dirty blocks and whether a read/write miss evicts a dirty victim. Evaluate universal claims against this state model; allocation policy is separate from write policy.

2 marks · MSQ
Report issue

Track dirty blocks under cache write policies

Cache Memory

Question 53, GATE 2024: Two set-associative caches use LRU replacement. WBC is write-back; WTC is write-through. Which are true? A A WBC read miss never evicts a dirty block. B A WTC read miss never writes a victim block back to memory. C A WBC write hit can change a dirty bit. D A WTC write miss always writes its victim back before loading a block.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: B, C

Approach: Replacement policy selects the victim, whereas write policy determines whether the victim may contain newer data than main memory.
1. In a write-back cache, a write can modify the cached block without immediately updating memory. The dirty bit records this mismatch. On a write hit to a clean block, the bit can change from 0 to 1, proving C.
2. LRU selection does not guarantee a clean victim. A read miss can evict a dirty write-back block, which must then be written to memory. A's “never” is false.
3. Write-through propagates each write to memory, so a replaced cache block does not need an eviction-time dirty-block write-back in the standard completed-write model. Hence B is true.
4. D is false for the same reason. Moreover, a write-through cache may use no-write-allocate, in which case a write miss need not load a new block or select a cache victim at all.
Answer: B and C. Write-through memory traffic caused by the current write is not the same thing as writing back an evicted dirty block.

Original paper, page 33 · Answer key

1 mark · MSQ
Report issue

Cache Memory

Question 24, GATE 2022: WB and WT are set-associative LRU caches using write-back and write-through respectively. Select FALSE statements: A both need a dirty bit per block; B every WB write hit transfers data to main memory; C WT eviction causes no cache-to-memory transfer; D a WB read miss never evicts a dirty block.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: A,B,D

The question asks for false statements. A is false because write-through does not require dirty bits: writes already update memory. B is false because a write-back hit normally only changes the cache and marks the line dirty. C is true: evicting a write-through line needs no extra write-back. D is false because a write-back read miss can evict a dirty victim and consequently write memory. Thus A, B, D.

Dirty means the cached copy differs from memory. A write-back eviction of a clean victim needs no write; a dirty victim must be written before replacement. LRU determines which victim is chosen, not whether it is dirty, so a read operation can indirectly cause a write-back.

Original paper, page 19 · Answer key

2 marks · MCQ
Report issue

Cache Memory

Question 27, GATE 2021: Inclusive two-level cache L1,L2 with L2 larger. S1 read misses in write-through L1 do not cause dirty writebacks to L2. S2 write-allocate must accompany write-through and no-write-allocate must accompany write-back. A only S1; B only S2; C both; D neither.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Write-through propagates each L1 write to the next level, so an evicted L1 line does not need a dirty writeback to L2. S1 is true. Allocation on a write miss is a separate design choice, and the asserted mandatory policy pairing is false. Thus A; conventional write-back/write-allocate and write-through/no-write-allocate combinations already refute S2.

Separate write propagation from write-miss allocation. Write-through specifies when lower memory is updated; write-allocate specifies whether a missing block enters the cache. They are independent policy axes. Inclusion says L1-resident blocks also reside in L2; it does not reverse the normal dirty-state argument for write-through L1.

Original paper, page 68 · Answer key