Combined Paging and segmentation
The respective merits of paging and segmentation can be combined into a paged-segmented system. Segmentation is visible to the programmer and meets many of his requirements. Paging provides transparent memory management which eliminates wasted space and facilitates complex optimization techniques.
A combined paged/segmented system appears to the programmer to be a simple segmented system; however, the segments defined are subdivide at the physical level into a number off fixed length pages. Pages do not bridge segments; a segment smaller than a page will use a whole page, and typically one page within a segment will be partially unfilled. The diagram below shows how a process could be divided into paged segments.
Address translation in a paged segmented system combines the translations of the individual paging and segmentation systems. A memory reference is specified by a three element value such as:
(s, p, d)
where: s is the segment number
p is the page within this segment
d is the displacement within this page
The figure below shows the complete translation process. The segment number, S, is used as an index to a segment table, as before. The segment descriptor, among other things, contains a pointer to a page table for that segment; note that each segment is treated as an independent address space, each with its own page table. The page number, p, is used to index this page table which translates the virtual page number p to a physical page number. The displacement d is then used to locate the exact address within this physical page frame.
A paged-segmented system is clearly quite complex, but provides a powerful environment for modem computers, giving the programmer control over process structure while efficiently managing memory space. Among current systems using such a scheme are Microsoft Windows, OS/2 and IBM MVS/ESA.
Segmentation lends itself to the implementation of protection and sharing policies. To achieve sharing, it is possible for a segment to be references in the segment tables of more than one process. This mechanism is available in a paging system. However, in this case the page structure of programs and data is not visible to the programmer, making the specification of protection and sharing more difficult to implement