Who assigns page frame numbers?
A student writes:
Dr. Patt,
How are you? I'm just wondering out of curiosity
how the page frame numbers are assigned to each page
table entry. That's the first question. The second
question is are they are assigned randomly. The third
question is if this assignment is done by the OS.
If not, what process does that assignment. Thank a lot.
The page frames are assigned by the virtual memory management system,
a piece of software that is part of the operating system. It is called
as part of the servicing of a page fault. The software maintains a
data structure from which it picks a candidate page frame to assign to
the page that is not resident and contains the location that caused the
page fault. There are several ways for this piece of software to pick
the page frame to assign. In class I mentioned the *reference bit*
approach. Another way is for the memory mangagement software to maintain
a *free list*, a list of frames that are available for assignment to
incoming pages.
In any case, once the frame is assigned, and the page loaded from the
disk, the PTE of the page is updated by this software with the PFN of
the frame, and the Valid bit set. Then control returns to the user
program and the memory access is again attempted. Now the page is
resident so the access can occur.
OK?
Yale Patt