Algorithm
1. Bind virtual address to physical address
2. If the address is illegal terminate the process
3. Find page table containing address (look up page table)
4. If the page table is in memory
get data and finish instruction
advance to next instruction
return to step 1
else
generate a page interrupt
call page interrupt handler
5. The page interrupt handler takes the following action
Find a free frame in memory (memory map table)
if there is no free memory frame then:
Select a page to be swapped out using Page Replacement algorithm
Update process’s page table
if contents of page have been modified then
writ page to disk
endif
6. load the request page into freed frame
7. update page table
8. update memory map table
When an executable file is first used to create a new process, only a portion of the program and data for that file may be loaded into real memory. Later as page faults occur, new portions of the program and data are loaded. It is only at the time of first loading that virtual memory pages are created and assigned to locations on one of the devices (hard disks) used for swapping.