With paging, all components of a program, including code, static data, the stack, and other data structures, are combined into one contiguous address space divided into fixed-size pages.
Segmentation addresses the problem by providing multiple logical address spaces for each process, where each segment can have a different size.
A segment is a variable-size block of a logical address space identified by a single number, the segment number.
A segment table is an array that keeps track of which segment resides in which area of physical memory. Each entry corresponds to one segment and contains the starting address of the segment.
The main advantage of segmentation is the ability to create multiple variable-size address spaces. The main advantage of paging is the ability to place any page into any frame in memory. To gain the advantages of both, segmentation can be combined with paging.
Each process has one segment table where each entry points to a page table corresponding to one of the segments and each page table entry points to a page frame.
Paging and segmentation both double the number of memory accesses because the address translation must first access the segment or page table. When segmentation is combined with paging, the number of memory accesses triples: First the segment table is accessed, then a page table, and finally the page holding the addressed word.
A translation lookaside buffer (TLB) is a fast associative memory buffer that maintains recent translations of logical addresses to frames in physical memory for faster retrieval. However, it can only store a small number of translations.
Given that recent places in memory are more likely to be accessed again, it looks to replace old data stored and keep the most recent.
Segmentation and Paging was originally found on Access 2 Learn