operating-systems

Definition

Segmentation

Segmentation divides a program into logical blocks of varying lengths called segments (Code, Data, Stack). Unlike paging (fixed-size), segments reflect the program’s logical structure.

A logical address consists of a segment number and offset. The OS maintains a segment table per process mapping to physical memory.

Properties

No Internal Fragmentation

Segments are exactly as large as the data they hold.

External Fragmentation

Highly prevalent — variable-sized segments create unusable holes in RAM.

Protection and Sharing

Easier to implement — entire logical units (e.g., shared libraries) can be placed in a single segment with specific permissions.