Memory segmentation Created 2026-10-13 Updated 2026-11-05
Memory segmentation divides an address space into segments described by a base, limit and access attributes in the classic base-and-bound model. A logical address selects a segment plus an offset; the processor checks the offset against the limit and combines it with the base. This can associate different protections with code, stack and data. Paging instead divides mappings into fixed-size pages, and architectures can combine both mechanisms. Virtual-memory segmentation differs from an application's informal division of a flat address space into code and heap regions.
// Target: computer-science.bigb
Paging divides a virtual address space into fixed-size pages mapped independently to fixed-size physical frames. It avoids external fragmentation of physical memory, although the last page of an allocation can contain unused space. Pages are principally allocation units and need not coincide with meaningful program objects.
Memory segmentation instead presents logical variable-sized regions such as code, a stack or a data object. An address contains a segment identifier and an offset; a segment descriptor gives a base, limit and permissions. The offset is checked against the limit. Pure contiguous physical segmentation can suffer external fragmentation and may need relocation or compaction, but its object-level boundaries aid protection and sharing.
Combine the two by mapping a segment offset to a linear virtual address and then using paging for physical allocation, or by having each segment descriptor refer to its own page table. Cache descriptors and translations so ordinary references do not repeatedly traverse all tables. Segment pages may occupy noncontiguous frames, while bounds and rights remain defined at segment granularity. Segmentation supplies logical objects and bounds; paging supplies efficient noncontiguous physical storage.