Hardware Reference
In-Depth Information
FIGURE B.21 Example of how paging and segmentation divide a program .
The decision to use paged virtual memory versus segmented virtual memory affects the
processor. Paged addressing has a single fixed-size address divided into page number and
offset within a page, analogous to cache addressing. A single address does not work for seg-
mented addresses; the variable size of segments requires 1 word for a segment number and 1
word for an offset within a segment, for a total of 2 words. An unsegmented address space is
simpler for the compiler.
The pros and cons of these two approaches have been well documented in operating sys-
tems textbooks; Figure B.22 summarizes the arguments. Because of the replacement problem
(the third line of the figure), few computers today use pure segmentation. Some computers use
a hybrid approach, called paged segments , in which a segment is an integral number of pages.
This simplifies replacement because memory need not be contiguous, and the full segments
need not be in main memory. A more recent hybrid is for a computer to offer multiple page
sizes, with the larger sizes being powers of 2 times the smallest page size. The IBM 405CR em-
bedded processor, for example, allows 1 KB, 4 KB (2 2 × 1 KB), 16 KB (2 4 × 1 KB), 64 KB (2 6 × 1
KB), 256 KB (2 8 × 1 KB), 1024 KB (2 10 × 1 KB), and 4096 KB (2 12 × 1 KB) to act as a single page.
FIGURE B.22 Paging versus segmentation . Both can waste memory, depending on the
block size and how well the segments fit together in main memory. Programming languages
with unrestricted pointers require both the segment and the address to be passed. A hybrid
approach, called paged segments , shoots for the best of both worlds: Segments are com-
posed of pages, so replacing a block is easy, yet a segment may be treated as a logical unit.
 
 
Search WWH ::




Custom Search