From paging we have eliminated extrnal fragmentation and we can get a convenient way of allocating memory (since any free page frame can be allocated to a page). On the other hand, with segmentation we get a logical division of programs and sharing of code is readily available. In order to combine the advantages of these two virtual memory techniques we can divide the segments into pages and come up with a new virtual addressing technique called paged segmentation.
In this scheme, the virtual address is represented by a triple (s,p,d'),where s is the segment number, p is the page number, and d' is the displacement within the page.The operating system has to define a mapping for the segments and their pages from the user space (virtual store) only physical address space of the machine. The operating system must provide the necessary mapping data to the address translation hardware so that the mapping can be effected as the user program is executed.
For each user proces, there are two maps - two stages in the mapping procedure. The first map describes the segments, detailing their allowed usage, their size,etc., and where in the system memory their page - map tables have been placed. For each segment, there is a page map defining the page frames on the backing store and, if allocated, in main memory that correspond to each page.
At the very least, the address translation circuitry has
- the capability of breaking a user address (virtual address) into its three component parts, and;
- a register, the segment map register, that points to the start of the current process segment map.
The remapping of a user address then requires a double indirection. The address translation circuit accesses the segment map (segment number acts as the offset relative to the contents of the segment map register), get allowed usage + page map address, etc., check if required usage is all right, check offset against lenght of segments, if within segment perform second indirect cycle, this time looking in the page map using page number as index. When you have finally retrieved appropriate page frame number, combine with location in page to get the real address.