page fault is a type of exception raised by computer hardware when a running program accesses a memory page that is not currently mapped by the memory management unit
into the virtual address space of a process.
firstly, the operating system will check an internal table for this process to determine whether the reference was a valid or an invalid memory access.
If the reference was invalid, we terminate the process. If it was valid, but we have not yet brought in that page, we now page it in.
We find a free frame
by taking one from the free-frame list,If there is no enough
free frames in the main memory, one or more frames will be swapped out.
Then schedule a disk operation to read the desired page into the newly allocated frame.When the disk read is complete, we modify the internal table kept with the process and the page table to indicate that the page is now in memory.
lastly, restart the instruction, then the process can now access the page as though it had always been in memory.

![]()