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.