Test 3 - Virtual Memory

CS 438, Operating Systems Analysis


  1. What is swapping? Does it seem reasonable to swap in a system with virtual memory? Explain your answers.


    Swapping moves a process between primary and secondary memory; it usually refers to the round trip starting and ending in primary memory. Swapping is useful in a virtual memory system because physical memory may become over-committed to too many processes. Processes might, for example, begin allocating and using large amounts of heap memory, or might begin to show poor locality of reference, increasing the size of their working sets. Swapping out processes in such cases might help relieve overcrowding.


  2. Suppose you are designing an operating system and want to use random page replacement in conjunction with a working-set estimator. In terms of minimizing paging rates, and just considering random replacement and the working-set estimator, is it better if your estimator over-estimates or under-estimates the size of a process's working set? Explain your answer.


    Random page replacement throws out any page in primary memory; the problem with random page replacement is that it could throw out a page that's in a process's working set.

    If the working-set estimator under-estimated a process's working set, it's almost certain that a randomly selected page will be missed as soon as it ejected. On the other hand, if the estimator over-estimated working set sizes, some of the pages associated with each process will be expendable, in the sense that they haven't been used recently and probably won't be used in the near future. In this case, random page replacement is less likely to eject an active page than it would be if the working set size was under-estimated, so over-estimating is preferred.


  3. A colleague of yours is designing a virtual memory system in software and wants to know your opinion of the following optimization: rather than use a reference bit and a modified bit per page frame, just use a reference bit. After all, if a page was modified, it was obviously referenced, so one bit should be enough. What do you say to your colleague? Explain yourself in enough detail so that your colleague will see the wisdom of your opinion.


    It's not a good optimization. Although you do save a bit per page frame, you loose the ability to determine if a page has been written to or just read, which means every ejected page has to be written to secondary memory in case it's been changed since it was paged in. This doubles the paging overhead on only-read pages, makes paging more expensive than it needs to be.


  4. Does it seem reasonable to have a virtual address space that is smaller than physical memory? Explain your answer.


    Yes, it is reasonable. Paging lets a process execute without being entirely resident in physical memory, making it possible to pack more processes into physical memory than would otherwise be possible. In addition, paging makes it relatively easy to share memory between processes, removing the overhead of having common code in each process.



This page last modified on 6 March 2000.