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 MEMORYReplacementThe operating system may need to replace one or more other segments that already reside in realmemory to make space for a segment that is the object of a "segment-not-present" fault. The replacementpolicy determines which segments to eliminate and when to eliminate them.The choice of which segments to evict from RAM is crucial to the performance of the system. Thegoal is to evict only segments that will not soon be referenced. The difficulty is knowing which segmentswill not soon be referenced. Many different policies are discussed in the literature. They fall into threegeneral classes:• Naive policies that determine which segment to evict without any knowledge of segment accesspatterns• Historical policies that use information about prior access patterns to determine the probabilitythat a segment will soon be referenced• Optimal policies that use analyses of actual program control flow to determine the probability thata segment will soon be referencedHISTORICAL POLICIESThe <strong>iAPX</strong> <strong>286</strong> architecture supports gathering of historical information about actual segment accesspatterns via the accessed bit in executable and data segment descriptors. An operating-system modulethat periodically tests and resets the accessed bits of descriptors can develop a "profile" of segmentusage. The information gathered this way can be used both by the replacement policy module for runtimedecision making and by the operating system designers for improving replacement policy.A "profiler" works best if it takes samples at regular intervals. To find all descriptors, it must step thruLDTs. A profiler does not need to examine all descriptors in the system each time it is invoked; it needsonly to examine those of tasks that have run since the last time it was invoked. The same timer interruptprocedure used by the scheduler can invoke the profiler at appropriate times.A profiler may run either as a separate task or as a shared procedure in the current task. A profilerthat runs as a procedure in the current task can easily locate the LDT with an SLDT instruction. TheLSL (load segment limit) instruction helps the profiler find the size of an LDT. The LAR (load accessrights) instruction enables the profiler to test the accessed bit. A profiler that runs as a separate taskmay require the support of a PL-O procedure that locates LDTs and tests accessed bits in other tasks.A profiler must give special consideration to aliases. If the accessed bit in any of the aliases of asegment is set, the segment has been accessed. Here again, a PL-O segment may be needed to stepthrough the kernel's alias lists.OPTIMAL POLICIESMany of the optimal policies discussed in the literature are of theoretical interest only. They are usedas a standard against which to measure the performance of more practical policies.The segment-register fields of the TSS provide support for a trivial, but possibly useful, optimal policy.The replacement policy can assume that, next time any given task runs, all the segments identified bythe CS, DS, SS, and ES fields of the TSS will be referenced. The processor loads all these registersduring a task switch and causes a fault at that time for each not-present segment. Since the task cannotrun if anyone of these segments is not present, the replacement policy may as well replace all of them9-7 121960-001