iAPX 286 Operating System Writers Guide 1983
iAPX 286 Operating System Writers Guide 1983
iAPX 286 Operating System Writers Guide 1983
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CHAPTER 9VIRTUAL MEMORYThe memory legitimately addressed by the tasks running on an <strong>iAPX</strong> <strong>286</strong> (the virtual memory) mayexceed the actual memory available. You can use this capability to lower memory costs, substitutingdisk or other less expensive storage media for relatively expensive RAM. Virtual memory isolatesprogrammers from the amount of real memory in a computer system. The system designer can tradeoff performance against system cost using identical software.A system that supports virtual memory can be analyzed in terms of mechanisms and policies. The<strong>iAPX</strong> <strong>286</strong> has mechanisms that help your operating system manage the swapping of segments betweenRAM and less expensive memories. The operating system must implement additional mechanisms aswell as policies for efficient use of these mechanisms in a specific application.HARDWARE MECHANISMSThe 80<strong>286</strong> provides- the essential hardware mechanisms without which virtual memory systems wouldnot be possible. The segment is the basic unit of the virtual-memory scheme, just as it is the basicunit of the real-memory scheme. In each segment descriptor, the <strong>iAPX</strong> <strong>286</strong> architecture provides anaccessed bit and a present bit to aid the operating system in simulating the virtual memory space withavailable RAM.Accessed BitEvery descriptor for an executable segment or data segment has an accessed flag in the least significantbit position of the access rights byte. Each time a task loads segment register with a segmentdescriptor, the processor automatically sets the accessed bit in that descriptor. The processor does notautomatically reset the accessed bit; software must explicitly write a zero into the accessed bit. Theaccessed bit has a dual function in virtual memory management:• By testing and then resetting the accessed bit at regular intervals, the virtual-memory manager canmeasure how frequently the segment is being accessed.• For writable data segments, the accessed bit (when set) indicates that the segment may have beenchanged.Present BitEvery segment descriptor has a present flag in the high-order bit position of the access-rights byte. Theprocessor automatically tests this bit as it loads segment registers. If the present bit is reset, the processorcauses a trap. Which trap depends on the circumstances:• Trap 11 (Segment not Present) occurs when loading the CS, OS, or ES register with a not-presentsegment descriptor, when switching toa not-present TSS, when loading the Task Register by meansof the LTR instruction with a not-present TSS descriptor, or when loading the LOT register with anot-present LOT descriptor.• Trap.11 also occurs when loading CS with a gate descriptor that is marked "not present." Thiscondition does not necessarily mean that a segment is not present, however. The operating system9-1 121960-001