Section 12.7: Speeding up Virtual Memory (Frame 1)                     [     ][home][next]

Obviously a page fault involves a heck of a lot of work on the part of the operating system and a very long wait for the user program before it gets to resume. But because of the principle of locality, page faults are relatively rare. If a program is well-behaved and stays within a small region of memory during each phase of its life, page faults will only occur when it changes phase. For example, the initial phase might involve reading and preprocessing an input data file. Then the program goes into the next phase, a more computationally intensive one. If it suffers a page fault here, the program will be slowed down, but since it doesn't have to go back to the previous stage again, no extra page faults will occur. Thus, for well-behaved programs (and most are) the overhead of virtual memory is bearable.

However, there is another more subtle slowdown involved, and that is looking up the page number in the page table during every access to memory. This involves a memory access in itself, in addition to the eventual, desired memory access. Thus, we would expect computers that used virtual memory to run at half the speed of their non-virtual cousins.