Skip to main content

TLB, thrashing; coalescing vs compaction

Short answer

TLB is a fast cache for page-table entries; thrashing is excessive paging due to insufficient frames. Coalescing merges adjacent free holes without moving processes (e.g., 10K+15K become 25K), while compaction relocates processes to combine all free memory into one large block.

What is TLB and Thrashing? Write the differences between Coalescing and Compaction. Provide examples of both.

TLB

The Translation Lookaside Buffer is a small, fast associative cache in the MMU that stores recently used page-number to frame-number translations. On a memory reference the page number is searched in the TLB in parallel: on a hit the frame number is obtained without reading the page table in memory; on a miss the page table is consulted and the entry is added to the TLB. It reduces the effective memory access time (a typical TLB has 16 to 512 entries and a hit ratio above 90%).

Thrashing

Thrashing means a process (or system) spends more time paging than executing, because it has too few frames for its working set. A page is replaced and then referenced again immediately, causing a continuous stream of page faults and low CPU utilization. Remedy: working-set model, page-fault-frequency control, or lowering the multiprogramming level.

Coalescing vs compaction

PointCoalescingCompaction
IdeaMerge adjacent free holesMove processes together to join all holes
Process movementNoYes
CostLowHigh
ResultLarger hole where holes were adjacentOne single large hole

Example of coalescing: a 10 K hole and an adjacent 15 K hole (a process between them just terminated) become one 25 K hole.

Example of compaction: memory = OS | P1 (20 K) | hole 10 K | P2 (30 K) | hole 15 K. Moving P2 down gives OS | P1 | P2 | one hole of 25 K, so a 25 K process can now be loaded.

✓ Answer checked by Claude Opus 5.5 (high effort)

All Operating System chapter 4 questions →