Definition
Segmentation
Segmentation is a memory management technique that divides a program into several logical blocks of varying lengths, called segments (e.g., Code, Data, Stack).
Unlike paging, which uses fixed-size blocks, segments are variable-sized and reflect the logical structure of the program.
Mechanism
A logical address in a segmented system consists of a segment number and an offset. The OS maintains a segment table for each process to map these to physical memory.
- Segment Table Entry: Contains the Base (starting physical address) and the Length of the segment.
Characteristics
- Internal Fragmentation: Eliminated, as segments are exactly as large as the data they hold.
- External Fragmentation: Highly prevalent, as placing segments of varying sizes creates unusable holes in RAM.
- Protection and Sharing: Easier to implement because entire logical units (like a shared library) can be placed in a single segment with specific permissions.