CS FundamentalsVery hardProduct company interview · GATE level
A machine has 40-bit virtual addresses, 16 KB pages and 4-byte page-table entries. Every page table at every level must fit in a single page. How many levels of page tables are needed, and how many entries of the outermost table can ever be used?
- A. 3 levels; 4 entries
- B. 2 levels; 4096 entries
- C. 3 levels; 4096 entries
- D. 4 levels; 64 entries
Correct answer: A. 3 levels; 4 entries
The offset takes log2(16 K) = 14 bits, leaving 26 bits of page number. One page holds 16 KB / 4 B = 4096 entries, so each level resolves 12 bits. 26 bits need ceil(26/12) = 3 levels: 12 + 12 for the inner levels and only 2 bits for the outermost, so just 2^2 = 4 of its 4096 entries are usable. Two levels would resolve only 24 bits; a single table would need 2^26 entries, i.e. 256 MB.
More Operating Systems questions
- A 32-bit system uses two-level paging: 10 bits for the outer index, 10 bits for the inner index and a 12-bit offset, with 4-byte entries…
- A 32-bit system uses two-level paging with a 10-bit outer index, a 10-bit inner index and a 12-bit offset. The virtual address 0xC0A8F3E7…
- A system with a TLB and a two-level page table has TLB access time 10 ns (searched before memory), memory access time 100 ns and a TLB hit…
- Memory access takes 200 ns. A page fault takes 8 ms to service if the replaced page is clean and 20 ms if it is dirty, and 40% of replaced…
- An inode has 10 direct pointers, one single-indirect, one double-indirect and one triple-indirect pointer. Blocks are 2 KB and block…
- A Unix-style inode has 12 direct pointers plus single-, double- and triple-indirect pointers; blocks are 4 KB and pointers 4 bytes. With…