Implementation of Demand Paging in OS

The main steps involved in demand paging that is in between the page is requested and it is loaded into main memory are as follows:-

  1. CPU refers to the page it needs.
  2.  The referred page is checked in page table whether that is present in main memory or not.If not an interrupt page fault is generated.
  3. OS puts the interruptes  process in blocking state and  starts the process of fetching the page from memory so that process can be executed.
  4. OS will search for it in logical address space.
  5. Required page will be brought from logical address space to physical address space. The page replacement algorithms are used for the decision making of replacing the page in physical address space.
  6. Page table will be updated.
  7. Interrupted process will be restarted.

These are  steps when a page required is missing from the memory.

Performance of Demand Paging

Demand paging can significantly affect the performance of a computer system.
To see why, let’s compute the effective access time for a demand-paged
memory. the memory-access time, denoted ma,ranges from 10 to 200 nanoseconds.

effective access time = (1 − p) × ma + p × page fault time.

where p is probability of page fault.

Three major activities
– Service the interrupt – careful coding means just several hundred instructions needed
– Read the page – lots of time
– Restart the process – again just a small amount of time