CS FundamentalsHardGATE CS (PYQ pattern)
A process maps a region starting at virtual address 0x40000000 whose size is 4 GB + 5 MB + 12 KB. The OS uses 1 GB, 2 MB and 4 KB pages, each aligned to its own size, and always takes the largest page that fits at the current address. How many leaf page-table entries (pages of all sizes together) map the region?
- A. 262
- B. 265
- C. 2051
- D. 10
Correct answer: B. 265
0x40000000 is 1 GB-aligned, so 4 x 1 GB pages come first. The remaining 5 MB + 12 KB starts 1 GB-aligned: 2 x 2 MB pages take 4 MB, and the last 1 MB + 12 KB needs 256 + 3 = 259 pages of 4 KB. Total 4 + 2 + 259 = 265. Rounding the tail up to a 2 MB page gives 10; forgetting the 12 KB gives 262; using only 2 MB pages gives 2051.
More Operating Systems questions
- A 32-bit machine has 512 MB of RAM, of which the resident kernel permanently uses 128 MB, and a 1 GB swap partition. The top 1 GB of every…
- On a single-CPU system processes arrive at 3 per second in steady state, on average 6 processes sit in the ready queue (not counting the…
- Stride scheduling with stride = 6000 / tickets: A has 100 tickets, B 200 and C 300. All passes start at 0; each quantum the process with…
- A CFS-like scheduler picks the runnable task with the smallest virtual runtime and runs it for a 4 ms slice, then adds 4 x 1024 / weight…
- Three tasks share two resources under the priority ceiling protocol (priorities t1 > t2 > t3). t3 has a 4 ms critical section on R1 and a…
- Rate-monotonic tasks (C, T = D, worst-case blocking B): t1 (2, 5, 2), t2 (2, 8, 2), t3 (4, 12, 0). Response time R = C + B + sum over…