0% found this document useful (0 votes)
452 views

Steps For Handling Page Fault - Easy Notes

The document summarizes the steps involved in handling a page fault when using virtual memory. When a process references a page that is not loaded in memory, a page fault occurs. This triggers a series of steps: 1) validate the memory address, 2) if invalid, terminate process, 3) if valid, find a free frame, 4) page in the required page from disk, 5) update the page table and change the invalid bit, 6) restart the faulting instruction once the page is loaded. Locality of reference means multiple faults are rare in practice.

Uploaded by

anu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
452 views

Steps For Handling Page Fault - Easy Notes

The document summarizes the steps involved in handling a page fault when using virtual memory. When a process references a page that is not loaded in memory, a page fault occurs. This triggers a series of steps: 1) validate the memory address, 2) if invalid, terminate process, 3) if valid, find a free frame, 4) page in the required page from disk, 5) update the page table and change the invalid bit, 6) restart the faulting instruction once the page is loaded. Locality of reference means multiple faults are rare in practice.

Uploaded by

anu
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Easy Notes

Steps for handling page fault

October 16, 2015 Professor Merwyn


Uncategorized
(h ps://professormerwyn.files.wordpress.com/2015/10/page-
fault.jpg)

The basic idea behind paging is that when a process is swapped


in, the pager only loads into memory those pages that it expects
the process to need ( right away. )
Pages that are not loaded into memory are marked as invalid in
the page table, using the invalid bit. ( The rest of the page table
entry may either be blank or contain information about where to
find the swapped-out page on the hard drive. )
If the process only ever accesses pages that are loaded in
memory ( memory resident pages ), then the process runs
exactly as if all the pages were loaded in to memory.
On the other hand, if a page is needed that was not originally
loaded up, then a page fault trap is generated, which must be
handled in a series of steps:
1. The memory address requested is first checked, to make sure
it was a valid memory request.
2. If the reference was invalid, the process is terminated.
Otherwise, the page must be paged in.
3. A free frame is located, possibly from a free-frame list.
4. A disk operation is scheduled to bring in the necessary page
from disk. ( This will usually block the process on an I/O
wait, allowing some other process to use the CPU in the
meantime. )
5. When the I/O operation is complete, the process’s page table
is updated with the new frame number, and the invalid bit is
changed to indicate that this is now a valid page reference.
6. The instruction that caused the page fault must now be
restarted from the beginning, ( as soon as this process gets
another turn on the CPU. )
In an extreme case, NO pages are swapped in for a process until
they are requested by page faults. This is known as pure demand
paging.
In theory each instruction could generate multiple page faults.
In practice this is very rare, due to locality of reference, covered
in section 9.6.1.
The hardware necessary to support virtual memory is the same
as for paging and swapping: A page table and secondary
memory. ( Swap space, whose allocation is discussed in chapter
12. )
A crucial part of the process is that the instruction must be
restarted from scratch once the desired page has been made
available in memory. For most simple instructions this is not a
major difficulty. However there are some architectures that
allow a single instruction to modify a fairly large block of data,
( which may span a page boundary ), and if some of the data
gets modified before the page fault occurs, this could cause
problems. One solution is to access both ends of the block before
executing the instruction, guaranteeing that the necessary pages
get paged in before the instruction begins.

Advertisements
REPORT THIS AD

Create a free website or blog at WordPress.com.


(h ps://wordpress.com/?ref=footer_website)

You might also like