Segmentation - alternative to Virtual memory paging.
Paging (VM)
Constant size pages.
Page id used as index into page table.
Simple page table design.
Simple implementation - quick resolution of page id.
Wastes space if block of code/data smaller than size of page.
Segmentation
Variable sized page fit to size of code/data being loaded.
Requires both a base address (start location) and a bounds limit (size
of segment).
Requires a more complex technique for identifying the current segments
of interest because memory not directly mapped address.
Machines(cpus) that support segmentation often have additional registers.
More efficient use of memory.
Allows task to be more easily segmented into separate segments, each with
its own access permissions. (data and code in separate segments)
Fragentation(external) can occur.
As task finishes, segments freed.
However, if new task needs larger segment than freed one
Another segment allocated.
Eventually, all of memory fragmented in block too small to use.
Requiring segment consolidation or "garbage collection"
Its possible to combine paging and segmentation.
Usually memory is segmented.
Then each segment is divided up into pages
and each segment given its own page table.