Dirty bit for a page in a page table
20082015
Dirty bit for a page in a page table
- A.
helps avoid unnecessary writes on a paging device
- B.
helps maintain LRU information
- C.
allows only read on a page
- D.
None of the above
Attempted by 28 students.
Show answer & explanation
Correct answer: A
In a page table entry, the dirty bit (also called the modified bit) is a single flag set by hardware whenever the CPU writes to that page. It carries no information about read/write permission or how recently the page was used - its only job is to record whether the page's in-memory contents differ from what is stored on the paging device (swap space/disk).
When the operating system needs to evict a page during page replacement, it checks this bit. If the dirty bit is clear, the physical page is identical to its copy on the paging device, so the OS can simply discard the frame and reuse it - no disk write is required. If the dirty bit is set, the OS must first write the page back to the paging device before the frame can be reused. This is exactly what lets the dirty bit avoid unnecessary writes on the paging device.
Recency-of-use for a replacement policy like LRU is tracked separately, via reference/accessed bits or the policy's own bookkeeping structures - the dirty bit says nothing about how recently a page was used.
Restricting a page to read-only access is controlled by a separate protection/permission bit in the page table entry, distinct from the dirty bit.
Since one of the offered effects (avoiding unnecessary writes to the paging device) does correctly describe the dirty bit, 'None of the above' cannot be the answer.
A video solution is available for this question — log in and enroll to watch it.