Operating System Involvement with Paging

When the OS has work to do relocating to paging, there are the following four times:

  • process creation time
  • process execution time
  • page fault time
  • process termination time

In a paging system, whenever a new process is created, then the OS has to determine how large the program and data will be initially and create a page table for it, for the page table, space has to be located and initialised in the memory.

Here, the page table needn't be resident when the process is swapped out, but it has to be in the memory when the process is running.

Whenever a process is scheduled for the execution, then the memory management unit has to be reset for new process and TLB flushed just to get rid of traces of previously executing process.

Now the page table of new process has to be made current, just by copying it or a pointer to it to hardware register(s).

Optionally, all or some pages of the process can be brought into the memory just to reduce the number of page faults initially.

But when a page fault occurs, then the OS has to read out the computer hardware registers just to determine which virtual address cause that fault. Now, from this information, it must compute that which page is needed and locate that page on the disk.

After doing the above task after a page fault occurring, the OS must find the available page frame just to put the new page, evicting some old page if needed, then it must read the needed page into the page frame.

Now finally, the OS must backup the program counter to have it point to the faulting instruction and let that instruction execute again.

In last, when the process exists, then the OS must release its pages, page table, and disk space that pages occupy when they are on the disk.

In case if some pages are shared with some other processes, then pages in the memory and on the disk can only be released when the last process using them has terminated.

Operating System Online Test

« Previous Tutorial Next Tutorial »

Follow/Like Us on Facebook

Subscribe Us on YouTube