Saturday, June 29, 2013

When do page fault occur? Describe the actions taken by an OS when a page fault occur?



Any computations and executions take place only when the program is resided in the main memory and it is getting the CPU time. This state of program is referred to as a process. Whenever a process undergoes computations the necessary pages from the auxiliary storage are copied down in the physical memory. At a particular instance of time the process may refer to the page that is not yet   resided in the physical memory but still present in the auxiliary memory, such an unpredictable condition is called a Page Fault. This condition is unpredictable, in perspective with the operating system because the OS cannot determine what type of page reference the process can make once the CPU is allocated to it.
Certain steps and procedure should be carried out by the OS whenever the page fault is generated to make the page available to the process. First step the OS follow is to determine if the page is valid in the auxiliary memory or not. If not certain message are given to the process. But if it is valid then certain calculations are carried out related to the page size and its content. Then certain page in the physical memory is selected which must be replaced by the requesting page, which is done by following certain page replacement algorithms.  Now the OS replaces the requesting page with the existing page in the physical memory and finally updates the page table and register values.

5 comments: