Demand paging follows that pages should only be brought into memory if the executing process demands them. This is often referred to as lazy evaluation as only those pages demanded by the process are swapped from secondary storage to main memory. Contrast this to pure swapping, where all memory for a process is swapped from secondary storage to main memory during the process start-up.
In pure demand paging a page is never moved from the backing store into main memory until that page is referenced. It is the responsibility of the operating system to check where the page is in main memory and OS uses an internal table for this. Operating system reads that page after finding it, and in order to reflect change, the page table is updated. So by using this process it is possible to run a process even its entire memory image is not taken from backing store into main memory.
In this way demand paging is a better approach then paging and it also increases the degree of multiprogramming and allows a process to run even it exceed the physical space allocated for it.
An invalid page is one that currently resides in secondary memory. When a process tries to access a page, the following steps are generally followed:
- Attempt to access page.
- If page is valid (in memory) then continue processing instruction as normal.
- If page is invalid then a page-fault trap occurs.
- Check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated (illegal memory access). Otherwise, we have to page in the required page.
- Schedule disk operation to read the desired page into main memory.
- Restart the instruction that was interrupted by the operating system trap.
Monday, January 11, 2010
Overview of Demand Paging
Posted by Sunflower at 1/11/2010 10:44:00 PM
Labels: Demand Paging, Invalid, Lazy evaluation, Memory, Page, Swapping, Valid
Subscribe by Email |
|
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment