Fragmentation: Internal vs External

Internal Fragmentation: Wasted Space Inside an Allocated Block

Fixed partition size: 100k
Process actually needs: 62k

+---------------------------+
| Process (62k) | Wasted (38k) |
+---------------------------+
(the wasted 38k is trapped inside this process's own partition,
 unusable by any other process)

Internal fragmentation happens when an allocated block is larger than what a process actually needs, wasting the difference - as covered in the previous note, this is the characteristic problem of fixed-size partitioning.

External Fragmentation: Wasted Space Scattered Between Blocks

+--------+------+--------+------+--------+------+
| Used   | Free | Used   | Free | Used   | Free |
+--------+------+--------+------+--------+------+
  20k     15k     30k      10k    25k      12k

Total free space: 37k - but no single free gap is large enough
for a new 30k process to fit into, even though 37k total is technically free.

External fragmentation happens when total free memory is genuinely sufficient, but it's scattered into small, non-contiguous gaps rather than existing as one continuous block - even though enough total space exists, no single gap may be large enough to satisfy a new request.

Comparing the Two Kinds of Waste

Internal FragmentationExternal Fragmentation
Where the waste isInside an allocated blockBetween allocated blocks, scattered
Associated withFixed-size partitioningDynamic-size partitioning
Common fixChoosing an appropriately small partition sizeCompaction, or paging (covered later in this section)

Compaction: One Direct Fix for External Fragmentation

Compaction shifts all currently allocated blocks together, consolidating every scattered free gap into one single, large, contiguous free block - solving the immediate problem, but at the real cost of the time it takes to physically move data around in memory.

Why This Motivated an Entirely Different Approach: Paging

Rather than continuing to patch external fragmentation with periodic compaction, paging (covered in detail later in this section) sidesteps the problem in a fundamentally different way - by not requiring a process's memory to be contiguous at all.

Written by Lorens Mishra

Software Engineer Notes Management System Administrator

Discussion

0 comments
Sign in to join the discussion.

No comments yet. Be the first to say something.