What does a page table entry contain besides the frame number?
Besides the frame number, an entry holds control bits: valid/present, read/write/execute permissions, a user/supervisor bit, a dirty (modified) bit and an accessed (reference) bit.
Explain it simply
A page table entry (PTE) is a row in the map saying where a page lives and what you may do with it. Think of a hostel room register: room number (frame), plus notes like "occupied", "visitors allowed", "needs repair".
Common fields:
- Frame number: which physical frame holds the page.
- Valid / present bit: 1 if the page is in RAM and the entry is usable. 0 means a page fault will occur on access.
- Protection bits: read, write, execute permissions.
- User/supervisor bit: whether user-mode code may access it.
- Dirty (modified) bit: set by hardware on a write. A dirty page must be written to disk before its frame is reused.
- Accessed (reference) bit: set by hardware on any access; used by replacement algorithms like clock.
- Caching bits: whether the page can be cached.
Example
Example PTE for a code page:
frame = 0x2A7 valid = 1 R = 1 W = 0 X = 1 user = 1 dirty = 0 accessed = 1- A write to this page: W = 0, so the hardware raises a protection fault and the OS typically kills the process.
- Page replaced later: dirty = 0, so the frame can be reused without a disk write because a clean copy already exists in the executable file.
Another PTE, for a data page that was modified: dirty = 1. Before reusing its frame, the OS must write it to swap space.
What to say in the interview
"Each entry holds the frame number plus a valid bit, protection bits, a user/supervisor bit, a dirty bit and an accessed bit. Valid triggers page faults, protection bits stop illegal writes, dirty decides whether eviction needs a disk write, and accessed feeds page replacement."
Common mistakes
- Forgetting that the valid bit being 0 does not always mean an illegal address; it can just mean the page is on disk.