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.
VIRTUAL MEMORYSOFTWARE POLICIESA virtual memory system gives each task the opportunity to affect other tasks in the system. Taskscompete with one another for real memory resources. One task may attempt to use memory in such away as to unduly impede the progress of other tasks. The operating system must enforce policies whichensure that every task makes appropriate progress.Virtual memory management policies are not unique to the <strong>iAPX</strong> <strong>286</strong>; the computer-science literaturecontains many discussions of policies that apply to various classes of applications. There is, however, adistinction between segmented architectures and paged architectures. The <strong>iAPX</strong> <strong>286</strong> has a segmentedarchitecture. Literature that deals with paged architectures may not apply to the <strong>iAPX</strong> <strong>286</strong>. Refer tothe paper by Denning (see "External Literature" in the Preface) for a broad survey of the science ofvirtual-memory management.The remainder of this chapter is an introduction to memory-management policy. The policies you needto consider are of three types: fetch policy, placement policy, and replacement policy.FetchThe fetch policy determines which segment to bring from swap space into RAM and determines whento bring it in.The simplest fetch policy is to bring in a segment on demand, that is, at the time it is referenced.Under this policy, the operating system brings in a segment from swap space only when the processorcauses a not-present exception as the result of a reference to the segment.All other fetch policies are in some way anticipatory. A simple example of an anticipatory fetch policyon the <strong>iAPX</strong> <strong>286</strong> is to always bring in the LDT of a task when bringing in its TSS. Some time-sharingsystems implement an anticipatory policy that brings in all the segments of a task at once. This policymay be suitable for tasks that consist only of one code segment, one or two data segments, and stacksegment (as, for example, simple BASIC programs submitted by students in a university environment).The swapping managers can use the segment register fields in the TSS (CS, DS, ES, SS) to identifythe task's working set.Attempting to implement such a full-task swap policy for more complex tasks that use many segmentsmay result in frequently fetching segments that are not referenced in anyone time slice.The additional complexity of implementing an anticipatory fetch policy is justifiable only if the anticipatorypolicy performs better than the demand policy. Given the efficiency of the <strong>iAPX</strong> <strong>286</strong> exceptionmechanism and given that in a multitasking environment there is usually some other task to servicewhile one task waits for the in-swap per to fetch a segment, an anticipatory policy typically does notprovide significantly greater throughput. An anticipatory policy may give better performance, however,when judged by performance standards other than throughput (for example, interrupt latency for specifictasks).PlacementDetermining where in RAM to place an incoming segment is the subject of Chapter 3. In a virtualmemorysystem, however, the constant reallocation of real memory to segments of varying length placesspecial demands on the operating system's memory management module. When choosing a spacemanagementalgorithm for a system that includes virtual memory, you may wish to give extra considerationto the trade-off between speed and memory fragmentation.9-6 121960·001