Section 12.5: Address spaces and page tables (Frame 6)                     [prev][home][     ]

When the OS finally gets back to the suspended job, it first looks to see if there is a vacant frame. If there is, it finds the page on disk by looking up its disk address. Then it reads the entire page from the disk by starting up special hardware to transfer in a large block of memory without constant supervision of the main CPU. While this is going on the OS continues working on some other job and only returns to the job when the block transfer is done. Then it updates the page table by inserting the frame number into the entry, setting the dirty bit to 0 and the present/absent bit to 1. Finally, the operating system marks the job as ready to run and when all other higher priority jobs have received their fair time slices, the OS turns control back to this job. Page faults are serious occurrences and should be minimized.

Disk addresses can be quite long. Typically, they include the disk drive number, the platter or surface in that disk drive, the track and finally the sector number. It is not uncommon for disk addresses to be 40 bytes long. In fact, they are usually so big that it is impractical to keep all of them in memory in the page table, so they are usually stored in another table on disk and only read in when needed. In this case, the page table in memory would only need the frame number, the dirty bit and the present/absent bit.

One way of avoiding saving long disk addresses in the page table is to calculate the disk address during a page fault. This can be done if the pages are stored on disk in a contiguous swap area, which is very common. In this case, all that is needed is the starting disk address which the operating system can store in just one place.