Tuesday, 12 August 2014

Segmented virtual memory

In the Intel 80386 & later IA-32 processors, the segments reside in a 32-bit linear, paged address space. Segments can be moved in & out of that space; pages there can "page" in & out of main memory, providing levels of virtual memory; few if any operating systems do so, in lieu using only paging. Early non-hardware-assisted x86 virtualization solutions combined paging & segmentation because x86 paging offers only protection domains whereas a VMM / visitor OS / visitor applications stack needs.[17]:22 The difference between paging & segmentation systems is not only about memory division; segmentation is visible to user processes, as part of memory model semantics. Hence, in lieu of memory that looks like a single giant space, it is structured in to multiple spaces.

Some systems, such as the Burroughs B5500,[13] use segmentation in lieu of paging, dividing virtual address spaces in to variable-length segments. A virtual address here consists of a segment number & an offset within the segment. The Intel 80286 supports a similar segmentation technique as an option, but it is never used. Segmentation & paging can be used together by dividing each segment in to pages; systems with this memory structure, such as Multics & IBM System/38, are usually paging-predominant, segmentation providing memory protection.[14][15][16]

This is not the same as the mechanisms provided by calls such as mmap & Win32's MapViewOfFile, because inter-file pointers do not work when mapping files in to semi-arbitrary places. In Multics, a file (or a segment from a multi-segment file) is mapped in to a segment in the address space, so files are always mapped at a segment boundary. A file's linkage section can contain pointers for which an try to load the pointer in to a register or make an indirect reference through it causes a trap. The unresolved pointer contains an indication of the name of the segment to which the pointer refers & an offset within the segment; the handler for the trap maps the segment in to the address space, puts the segment number in to the pointer, changes the tag field in the pointer so that it no longer causes a trap, & returns to the code where the trap occurred, re-executing the instruction that caused the trap.[19] This eliminates the necessity for a linker completely[3] & works when different processes map the same file in to different places in their private address spaces.

This difference has important consequences; a segment is not a page with variable length or a simple way to lengthen the address space. Segmentation that can provide a single-level memory model in which there is no differentiation between technique memory & file method consists of only a list of segments (files) mapped in to the process's potential address space.[18]

No comments:

Post a Comment