iAPX 286 Operating System Writers Guide 1983
iAPX 286 Operating System Writers Guide 1983
iAPX 286 Operating System Writers Guide 1983
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
VIRTUAL MEMORYmay attach other meaning to the present bit of gate descriptors. Refer to the section on load-timebinding in Chapter 11 for an example of an alternate use for the present bit in gate descriptors.• Trap 12 (Stack Exception) occurs when loading the SS register with a not-present descriptor. Theexception handler can distinguish this condition from other stack exceptions by examining the accessrights byte of the descriptor selected by the error code.• Trap 10 (Invalid TSS) occurs when switching to a TSS that points to a not-present LDT. Theexception handler can distinguish this from other "invalid TSS" conditions by examining the accessrights byte of the descriptor selected by the error code.• Trap 8 (Double Fault) occurs if the processor, while trying to invoke an exception handler due to aprevious exception, finds that the code segment containing its entry point is not present. The difficultyof distinguishing between this and other double fault conditions implies that trap 8 is to betreated as an error condition, not a normal use of the present bit.Refer to Chapter 7 for additional information about these traps.SOFTWARE MECHANISMSThe operating system must provide additional mechanisms for a virtual memory system: one for movinga segment from RAM to secondary storage (the swap-out manager) and one for moving a segmentfrom secondary storage to RAM (the swap-in manager).The swapping managers are essentially I/O modules, but there are major differences between swappingmanagers and the functions of a standard I/O subsystem:• Swappers deal with executable segments, system segments, and data segments that are not normallyconsidered I/O buffers.• I/O performance of swappers is critical and often calls for specialized device drivers and disk spaceallocation stategies.Secondary Storage ManagementVirtual-memory mechanisms use a secondary storage medium, such as disk, to simulate a larger memoryspace than that provided in RAM. The operating system uses this secondary storage (here called theswap space) to store copies of those segments that are currently in the virtual space but may beeliminated from RAM.There are two general approaches for allocating swap space for segments in dynamic systems:• The loader can invoke a swap-space allocation procedure as it loads the segments of a task. It canat the same time write an initial image of the segment into the swap space. This is particularlyuseful for a segment such as an executable segment that is occasionally swapped in but may neverbe swapped out (when its RAM space is used for another segment) due to the fact that its contentsdo not change.• The operating system may invoke the swap-space allocation procedure dynamically, either whenallocating RAM for the segment or at the first time the operating system swaps the segment out.Some operating systems may implement both approaches. A system that allocates swap space only atload-time cannot swap out certain segments; namely, segments that a bootIoader creates initially andsegments that the operating system creates dynamically. In many systems, this is not a problem. Often9-2 121960-001