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.
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.
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.
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.