When a program tries to use a page which is not memory, a page fault occurs. This is one of the reasons for a process to be suspended for I/O

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.


Понравилась статья? Добавь ее в закладку (CTRL+D) и не забудь поделиться с друзьями:  



double arrow
Сейчас читают про: