As the program runs, it may use up all the physical memory. When this happens, and the program needs yet another page, special steps must be taken. The operating system selects one of the frames to be used for the new page. However, it cannot just overwrite the frame of physical memory if that frame had been changed by the program, or else errors would result. A page that has been modified by memory write operations is called dirty. So the operating system copies the dirty page out to disk, and then uses that frame for the new page that is being brought in. Actually, if the frame's old contents were not altered, they could just be overwritten, saving a slow disk write. This would happen if the frame contained pure code or data that had not been changed. All pages that are not currently in frames of physical memory are stored on the hard disk in the swap area, so called because the pages in it are constantly swapped in and out of real memory. The next section makes all these words come alive through pictures. |