13.07.2015 Views

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

iAPX 286 Operating System Writers Guide 1983

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

VIRTUAL MEMORY• Return the RAM space used by the segment.• Delete the temporary data-segment descriptor.IN-SWAPPERIn theory, the fetch policy module, invokes the in-swapper. In practice, when the fetch policy is "ondemand," the in-swapper is the "not-present" fault handler, which may also be called by the stacksegment fault handler (for not present stack segments) and by the "invalid TSS" fault handler (for notpresent LDTs). The not-present fault handler can run as a procedure in the task that caused the fault.There is one case, however, that such a procedure cannot handle well. A dispatcher procedure runningin task A causes a not-present fault when switching to task B whose TSS is not present. If the notpresenthandler procedure continues running in task A, then task A must wait until task B's TSS canbe swapped in. Whether this is a problem depends on the role of task A in the application. The notpresenthandler procedure can avoid this situation by suspending task B and sending a message to yetanother task that is dedicated to swapping in TSSs.The steps that an in-swapper procedure takes are to• Get the swap-space address and segment size (limit) from the descriptor indicated by the error code.• Allocate a writable data segment in RAM large enough to receive the segment.• Copy the segment from swap space to the newly allocated RAM space.• Update all regular descriptors for the segment with the new base address, setting the present bitand resetting the accessed bit. (The base address comes from the temporary writable data-segmentdescriptor.)• Delete the temporary writable data-segment descriptor.An in-swapper task for not present TSSs gets a message from its input mailbox that identifies thedescriptor for the TSS and identifies the task to which the TSS belongs. The in-swapper task performsthe same steps as an in-swapper procedure, but it must also inform the scheduler when the task isready to run. You can avoid the additional complexities of not-present TSSs by not swapping TSSsout.COORDINATION OF IN- AND OUT-SWAPPERA number of interactions between the in-swapper and out-swapper present pitfalls that the operatingsystem must avoid:• A task may attempt to use a segment that is being swapped out. If the in-swapper does not handlethis possibility, it may swap in old, erroneous data from the swap-space.• Task A may request swapping in of a shared segment that is being swapped in for task B. If the inswapperblithely reads in the segment again for task A, it may overwrite changes made by task B.• A task may delete a segment that is being swapped out. If the swap-space release procedure doesnot allow for this case, the segment's swap space may be released and reallocated while the outswapperis writing to it.The in-swapper, out-swapper, and swap-space release procedures can control these interactions bymaintaining a shared table of all segments that are in transition. They must use a semaphore or regionto coordinate access to the shared table. The swap-space address can serve as the segment identifier inthe table.9-5 121960-001

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!