Fragmentation: The Reason for Using Paging

Why do computers even need to use paging?

If we were to store the instructions and variables of a program in blocks of unequal sizes, we would encounter the following 2 nasty problems:

  1. External fragmentation happens when the available memory is broken up into lots of little pieces, none of which is big enough store the instructions and variables of a program that we want to launch, although the combined holes' size could.
  2. Internal fragmentation happens when a program is given a chunk of memory that is larger than what the program requested or uses. Since memory is allocated to processes in blocks, the portion of a block that the process doesn't use is an internal fragment.

These problems affect not only main memory but also cache, disks, and other storage devices.

We can eliminate the external fragmentation problem and minimize the internal fragmentation problem by using pages!