CS FundamentalsHardGATE CS (PYQ pattern)
On a 4-level x86-64 style paging system (4 KB table pages, 512 eight-byte entries each, 2 MB pages are leaves at the third level), a process maps exactly one 1 GB-aligned, fully used 1 GB region and nothing else. How many page-table pages (all levels, root included) are needed with 4 KB pages and with 2 MB pages?
- A. 512 and 1
- B. 515 and 4
- C. 262,144 and 512
- D. 515 and 3
Correct answer: D. 515 and 3
4 KB pages: 2^30 / 2^12 = 262,144 leaf entries = 512 leaf tables, plus 1 third-level (page-directory) table, 1 second-level table and the root: 515. 2 MB pages: the 512 leaves live in one page directory, plus 1 second-level table and the root: 3. Counting only leaves gives 512 and 1.
More Operating Systems questions
- Polling a device costs a fixed 10% of the CPU (100,000 polls/s at 1 microsecond each) plus 0.5 microseconds of handling per event…
- In Lamport's bakery algorithm five processes P0 to P4 hold tickets (number, id): P0 has 4, P1 has 3, P2 has 4, P3 is not competing (0) and…
- A 200 KB heap is managed with a first-fit free list; adjacent free blocks are merged when memory is freed. Operations in order: alloc…
- A fixed-size job runs 6 times faster on 8 cores than on 1 core. Assuming Amdahl's law holds exactly (a serial fraction f, the rest…
- Three philosophers sit at a table with three forks; philosopher i always picks up fork i (left) first and then fork (i+1) mod 3 (right)…
- A data TLB has 64 entries organised as 16 sets of 4 ways (set index = virtual page number mod 16, LRU within a set). A loop touches…