- 2073 Bhadra · 2+3 marks
Compaction vs coalescing; paging mapping
Short answer
Compaction moves processes together to combine all free space into one; coalescing merges adjacent free blocks without relocating processes. Paging maps logical address by splitting into page number and offset; page table translates page to frame, and physical address = frame×size + offset. Example: with 4KB pages, address 9000 (page 2, offset 808) maps to frame 1 giving physical 4904.
Differentiate compaction and Coalescing technique. How is logical address mapped to physical address by Paging Technique? Explain with suitable example.
Compaction vs coalescing
| Point | Coalescing | Compaction |
|---|---|---|
| Meaning | Joins adjacent free blocks into one larger block | Shifts all used blocks to one end so free space becomes one block |
| Trigger | When a block is released next to a free block | When free memory exists but is split into small holes |
| Process movement | None | Processes are relocated |
| Overhead | Very low | High (copying, changing base addresses) |
| Requirement | None | Dynamic (run-time) relocation |
| Removes external fragmentation | Only partly | Completely |
Example: free blocks 100 K and 50 K next to each other form a 150 K block after coalescing. Memory with P1 (40 K), hole 20 K, P2 (30 K), hole 25 K: compaction moves P2 down next to P1, giving one 45 K hole.
Mapping logical to physical address in paging
Logical memory is split into pages and physical memory into frames of equal size (power of 2). The CPU generates a logical address = (page number p, offset d). The page table (one per process) gives the frame number f for page p. Physical address = (f × page size) + d. The offset is unchanged.
logical addr page table physical memory
+----+----+ +---+-----+ frame f
| p | d |-- p --> | p | f |-- f --> +---------+
+----+----+ +---+-----+ | ...d.. |
Example: page size = 4 KB (4096), logical address = 9000. Page table: page 0 → frame 3, page 1 → frame 6, page 2 → frame 1.
- p = 9000 div 4096 = 2; d = 9000 mod 4096 = 808.
- Page 2 is in frame 1.
- Physical address = 1 × 4096 + 808 = 4904.
Paging avoids external fragmentation but may have internal fragmentation in the last page of a process.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Compaction vs coalescing; paging; TLB · Operating System, chapter 4
- Logical and physical address bits · Operating System, chapter 4
- TLB, thrashing; coalescing vs compaction · Operating System, chapter 4
- Page fault, demand paging, address translation · Operating System, chapter 4
- Page fault; virtual to physical address · Operating System, chapter 4
- Physical vs logical clock; sync method · Distributed System, chapter 5 · asked 2×
- Physical vs logical clocks; Lamport · Distributed System, chapter 5