What this topic covers
9 subtopics- Paging11
- Page tables8
- TLB6
- Contiguous allocation5
- Fragmentation4
- Segmentation4
- Addresses3
- Allocators3
- Swapping1
- Beginner 15
- Intermediate 15
- Advanced 15
About this topic
Memory-management questions are mostly arithmetic on powers of two: split an address into page number and offset, size a page table, compute the effective access time with a TLB, or place requests with first, best and worst fit. Partitions are drawn to scale here, page and segment tables are shown as tables, and every number was computed by a program. 1 KB = 1024 bytes throughout.
Free preview
Sample questions
Try each one first, then open the answer for the explanation and why the other options are wrong.
Requests arrive in the order shown. With first fit, which hole does each request use? (Holes are named by their original size; a used hole shrinks.)
Show answer and explanation
Explanation
212 takes the first hole that fits (500, leaving 288). 417 skips 100, 288, 200 and 300 and takes 600 (leaving 183). 112 fits in the 288 left of the 500 hole. 426 fits nowhere: the largest hole is now 300.
Why the other options are wrong
- AThat is best fit.
- CThat is worst fit.
- D112 fits in the earlier 288 remainder, and 426 does not fit in 300.
32-bit logical addresses, 4 KB pages and 4-byte page-table entries. How large (in MB) is a single-level page table for one process?
The answer is a number – work it out, then open the solution.
Show answer and explanation
Explanation
2²⁰ entries × 4 bytes = 4 MB per process – a strong reason for multilevel page tables, which only allocate the parts in use.
48-bit virtual addresses, 4 KB pages and 8-byte page-table entries; every page-table node fills exactly one page. How many levels of page tables are needed?
The answer is a number – work it out, then open the solution.
Show answer and explanation
Explanation
4096 / 8 = 512 = 2⁹ entries per node, so each level resolves 9 bits. (48 − 12) / 9 = 4 levels – exactly x86-64's four-level paging. 57-bit addresses need a fifth level.