FOR FREE MATERIALS

Effective Memory Access Time (EMAT) with Page Fault   

 

Demand paging and Page Fault

 

Before seeing the chapter please follow previous chapters to get the concept easilyProblem of paging and solution, Implementation of TLB Calculate Effective Access Time (EMAT), Effective Access Time using Hit ratio and Miss ratio.

 

From the previous chapter Implementation of TLBwe know as per locality of reference, during the execution of a certain process, only a small number of pages is required frequently and few pages are kept on changing.

 

So, in virtual memory a part of the process and corresponding page table load into the main memory. The method by which the system loads a part of the process and page table is called demand paging.

 

Demand paging:

Load the pages of the process as per demand i.e. don’t load any page until required. Virtual memory is commonly implemented by demand paging. 

We can use demand paging to reduce the number of frames allocated to a process. This arrangement can increase the degree of multiprogramming (allowing more processes to be available for execution at one time) and—in theory, at least—the CPU utilization of the system.

 

Disadvantages:

This strategy loaded pages only on demand, not in advance so, at the beginning of the process, no page is available at the memory. When a process initiates to executes the first instruction, it goes to page fault.

 

On the other hand, each time when the process will require a new page that is not present in the main memory, a page fault will occur.

 

Page Fault:

If the page which is asked for CPU to execute the process is not present in memory, the MMU raises an interrupt called missing page interrupt or page fault (which is program interrupt).

 

In the previous chapter, we already discussed different bits of information of page entry: Number of information at page entry.

 

Here, one bit called a valid bit indicates whether the page described by the entry currently exists in memory. This bit is also called the presence bit.

 

We use the convention that one indicates resident in memory” and 0 indicatesnot resident in memory.”  So, when the valid bit is 0, it indicates a page fault.

 

After Page Fault

 

 

When page fault occurred, MMU invokes the virtual memory manager with the page number that caused the page fault as a parameter. The virtual memory manager now loads a page from secondary memory to main memory and updates its page table entry. 

 

Thus, the MMU and the virtual memory manager interact to decide when a page of a process should be loaded in memory.

 

Another case when page replacement is taking place:

If no page frame is free in main memory, the virtual memory manager performs a page replacement operation to replace one of the pages existing in memory with the page whose reference caused the page fault. 

 

Now, the virtual memory managers do it by use of page replacement algorithm to select one of the pages currently in memory for replacement, accesses the page table entry of the selected page to mark it as “not present” in memory. 

 

At the time of replacement of a page from the main memory, it is important to check the modified bit or dirty bit to see this page is modified or not. If it is modified then replace the modified version with secondary memory.

 

So, in conclusion, one thing is cleared that when page fault occurred it takes a lot of time for the whole procedure and the total execution time of the process will increase.

 

Thrashing:

A program causing page faults every few instructions is said to be thrashing. So, thrashing means a lot of page fault. A process is thrashing if it is spending more time paging than executing.