Size of a page table — OS, DBMS & Networks Aptitude Question
Size of a page table: A system uses 32-bit logical addresses with a page size of 4 KB. Answer and worked solution on CodeKairo.
- Topic: OS, DBMS & Networks
- Section: Programming MCQs
- Difficulty: Medium
- Time target: 90 seconds
Question
A system uses 32-bit logical addresses with a page size of 4 KB. How many entries does a single-level page table contain?
Options
- 2^12 (4 K)
- 2^16 (64 K)
- 2^20 (1 M)
- 2^32 (4 G)
Show the answer and the worked solution
Correct answer: C. 2^20 (1 M)
Worked solution
- A 4 KB page is 2^12 bytes, so 12 bits of the address are the offset.
- That leaves 32 − 12 = 20 bits for the page number.
- A page table holds one entry per possible page number, so it has 2^20 (1 M) entries.
Answer: 2^20 (1 M).
The idea
A table of a million entries per process is exactly why real systems use multi-level page tables, inverted page tables or hashed page tables rather than one flat array.
Shortcut. Entries = address space ÷ page size = 2³² ÷ 2¹² = 2²⁰.
Common trap. "2^12 (4 K)" confuses the 12 offset bits of a 4 KB page with the page-number bits; 12 bits index bytes inside a page, not pages.