GATE CS 2024 Set 1 — Question 53

MSQ+2 / -0MediumWrite-Through vs Write-BackMemory Hierarchy & CacheComputer Organization & ArchitectureCache Replacement PoliciesSet-Associative Cache

Computer Organization & Architecture → Memory Hierarchy & Cache → Cache Replacement Policies

Last updated

Question

Consider two set-associative cache memory architectures: WBC, which uses the write back policy, and WTC, which uses the write through policy. Both of them use the LRU (Least Recently Used) block replacement policy. The cache memory is connected to the main memory. Which of the following statements is/are TRUE?
A.
A read miss in WBC never evicts a dirty block
B.
A read miss in WTC never triggers a write back operation of a cache block to main memory
C.
A write hit in WBC can modify the value of the dirty bit of a cache block
D.
A write miss in WTC always writes the victim cache block to main memory before loading the missed block to the cache

Correct answer

(B) A read miss in WTC never triggers a write back operation of a cache block to main memory; (C) A write hit in WBC can modify the value of the dirty bit of a cache block

Solution

Step-by-step analysis of the statements:
1.Statement (A): In a Write-Back Cache (WBC), a read miss requires fetching a new block from main memory. If the cache set is full, a block must be evicted based on the LRU policy. If the evicted block is 'dirty' (modified in cache but not in main memory), it must be written back to main memory. Therefore, a read miss can evict a dirty block. Statement (A) is FALSE.
2.Statement (B): In a Write-Through Cache (WTC), every write operation updates both the cache and the main memory simultaneously. Consequently, no block in the cache is ever 'dirty' relative to main memory. When a read miss occurs and a block is evicted, there is no need to write it back. Thus, a read miss in WTC never triggers a write-back. Statement (B) is TRUE.
3.Statement (C): In WBC, a 'dirty bit' is associated with each cache block to track modifications. When a block is first loaded from memory, its dirty bit is 00. Upon the first write hit to that block, the dirty bit is changed (modified) to 11. Since the statement says it 'can modify', it is correct. Statement (C) is TRUE.
4.Statement (D): As established for WTC, there are no dirty blocks. Therefore, there is no 'victim' block that needs to be written back to main memory during a miss (read or write). The missed block is simply fetched and loaded. Statement (D) is FALSE.
Conclusion: Statements (B) and (C) are correct.

More questions on Memory Hierarchy & Cache

Practice GATE CS PYQs with adaptive difficulty

Timed practice, skill tracking, and AI explanations — free to start.

Start practicing free