Segmentation (Memory)
The discussion of Virtual Memory focuses on paging, which uses fixed-size blocks.
In segmentation, we use a variable-size block scheme.
- Program is divided into segments
- All segments of all programs do not have to be of the same length
- There is a maximum segment length
- Addressing consist of two parts: (segment number, offset)
- Since segments are not equal, segmentation is similar to Dynamic Partitioning
- But program can have more segments (but only one partition)
Difference with Dynamic Partitioning?
Very similar, can suffer from external fragmentation. But just like Paging, a process can be assigned multiple partitions (called segments) in this case.
The Pros
Just like dynamic partitioning, segmentation eliminates internal fragmentation (which paging suffers from).
- The ideas of a segment table are very similar to what we do for a Page Table. But here, we also store the length of the segment since those can vary
I don’t know if there is a relation between this and Segmentation Fault.