Memory Hierarchy
In a write-back cache, what is the role of the dirty bit attached to each line?
- AIt shows whether the line's data is valid and can be read
- BIt shows the line was modified and differs from memory
- CIt shows the time the line was last accessed
Show answer and explanation
Answer: B. It shows the line was modified and differs from memory
A write-back cache completes writes in the cache alone, so some lines end up newer than main memory. The dirty bit marks such modified lines so that only dirty lines need to be written back on eviction; clean lines can simply be discarded, avoiding wasted writes. Validity is indicated by the valid bit, and access order is tracked by separate replacement information such as LRU state.
- A. Validity is indicated by the valid bit.
- B. Correct. It marks the line as modified, deciding whether it is written back on eviction.
- C. Access order is separate information used by the replacement policy.