Phase 5Ch 5.1 Contiguous allocationCh 5.2 Paging
ACompressed recap
Base/limit: L < limit → base + L. Fixed partitions → internal, variable → external fragmentation; first/next/best/worst fit. Paging: offset = log₂(page size) bits, page number = the rest; physical = f × size + d; page table = #pages × PTE; frame bits = physical bits − offset bits. TLB EAT = h(t + m) + (1 − h)(t + 2m); multilevel: levels = ⌈page bits / log₂(page size / PTE)⌉, miss = t + (k + 1)m; inverted table per frame. Segmentation: (s, d), base + d if d < limit; external fragmentation.
BMerged rule card
5.1.1 Addresses and contiguous allocation: fits and fragmentation
- Logical address from the CPU; MMU makes the physical address.
- Base/limit: if L < limit then physical = base + L, else trap.
- Fixed partitions → internal fragmentation; variable → external; compaction merges holes.
- First fit (first big enough), next fit (continue from last), best fit (smallest big enough), worst fit (largest).
- 50% rule: N blocks allocated → about 0.5N lost (one third).
5.2.1 Paging: pages, frames, page tables and the address split
- Page = frame size = 2ᵈ; offset = low d bits; page number = high m − d bits.
- Physical = frame × page size + offset.
- Page-table size = (#pages) × (PTE size); frame bits = physical bits − d.
- PTE: frame, valid, protection, dirty, referenced. Shared code → same frames.
- Paging: internal fragmentation only (≈ half a page per process).
5.2.2 TLBs, effective access time and multilevel page tables
- EAT = h(t + m) + (1 − h)(t + 2m); with k levels the miss costs t + (k + 1)m.
- TLB: small associative cache; flush on switch unless ASIDs.
- Multilevel: entries per page = page size / PTE; bits per level = log₂ of it; levels = ⌈(m − d) / bits per level⌉.
- Inverted table: one entry per frame, searched via hashing.
5.2.3 Segmentation, and segmentation with paging
- Segment table entry (base, limit); (s, d) → base + d if d < limit, else trap.
- Paging: equal pieces, internal fragmentation. Segmentation: logical pieces, external fragmentation, natural sharing/protection.
- Segmentation with paging: (s, p, d); each segment paged.
CInterleaved GATE-style questions
Q1 · NAT · 1 mark(s) — Base/limit
Base 7000, limit 2500. Physical address of logical address 2499?
Numerical answer: ________
Q2 · NAT · 2 mark(s) — Worst fit
Holes 150, 350, 200, 500, 100 KB; requests 180, 90, 320, 240 KB by worst fit. Size of the hole that the 240 KB request is placed in (its size just before placement)?
Numerical answer: ________
Q3 · NAT · 1 mark(s) — Pages
A 64 KB logical address space with 2 KB pages has how many pages?
Numerical answer: ________
Q4 · NAT · 2 mark(s) — Translation
Pages are 2 KB. Logical address 9000 is on page p; page p is in frame 7. Physical address?
Numerical answer: ________
Q5 · NAT · 2 mark(s) — Page table
Logical addresses 34 bits, pages 16 KB, entries 4 bytes. Page-table size in MB?
Numerical answer: ________
Q6 · NAT · 1 mark(s) — EAT
Memory 80 ns, TLB time negligible, hit ratio 0.75. EAT in ns?
Numerical answer: ________
Q7 · NAT · 2 mark(s) — Levels
39-bit virtual addresses, 4 KB pages, 8-byte entries, each table one page. Number of levels?
Numerical answer: ________
Q8 · MCQ · 1 mark(s) — Segmentation
Which statement about segmentation is true?
- (A) Translation is base + offset after the check offset < limit
- (B) It needs no table
- (C) It has no fragmentation
- (D) All segments have the same size
DAnswer Vault
Try the questions first. Open when you are ready to check.
🔐 Open the Answer Vault
Q1 Answer: 9499 · 1 mark(s)
Just inside the limit.
Re-read: Lesson 5.1.1 — Addresses and contiguous allocation: fits and fragmentation
Q2 Answer: 260 · 2 mark(s)
After 180 → 500 (320 left) and 90 → 350 (260 left), 320 takes the 320 piece; 260 is now the largest.
Re-read: Lesson 5.1.1 — Addresses and contiguous allocation: fits and fragmentation
Q3 Answer: 32 · 1 mark(s)
2¹⁶ / 2¹¹.
Re-read: Lesson 5.2.1 — Paging: pages, frames, page tables and the address split
Q4 Answer: 15144 · 2 mark(s)
p = 4, offset 9000 − 8192 = 808; 7 × 2048 + 808.
Re-read: Lesson 5.2.1 — Paging: pages, frames, page tables and the address split
Q5 Answer: 4 · 2 mark(s)
2²⁰ entries × 4 B.
Re-read: Lesson 5.2.1 — Paging: pages, frames, page tables and the address split
Q6 Answer: 100 · 1 mark(s)
0.75 × 80 + 0.25 × 160.
Re-read: Lesson 5.2.2 — TLBs, effective access time and multilevel page tables
Q7 Answer: 3 · 2 mark(s)
27 page bits / 9 per level.
Re-read: Lesson 5.2.2 — TLBs, effective access time and multilevel page tables
Q8 Answer: (A) · 1 mark(s)
Per-segment base and limit.
- (B) is wrong: The segment table.
- (C) is wrong: External fragmentation.
- (D) is wrong: Sizes vary.
Re-read: Lesson 5.2.3 — Segmentation, and segmentation with paging