memory-managementoperating-systemcontiguous

Solution to external fragmentation- Non-contigous allocation


As far as my understanding goes, a program is allocated contiguous address spaces in the virtual memory. The address space contains the heap, the stack, the data and text section, and some free space.

But actually, the these sections are not contiguous in the physical memory (RAM). If this is the case, then can't it solve external fragmentation? I mean, the whole point of external fragmentation is that we do not have enough contiguous space. So, why not break-up the segments and use the non-contiguous space?

I know that I am missing something. Can someone elaborate on this? Thanks.


Solution

  • The logical to physical page mapping solves one fragmentation problem but not all of them. An operating system typically has memory pools that can become fragmented. Also, there is some need to for the operating system to manipulate physical memory. One example is the page tables themselves. Some portion (if not all—depends upon the underlying hardware) of a page table must be in physical memory.