What is Demand Paging?

Demand Paging :

  • Consider how an executable program might be loaded from disk into memory. One option is to load the entire program in physical memory at program execution time. However, a problem with this approach is that we may not initially need the entire program in memory. An alternative strategy is to load pages only as they are needed. This technique is known as demand paging and is commonly used in virtual memory systems.
  • With demand-paged virtual memory, pages are loaded only when they are demanded during program execution. Pages that are never accessed are, thus, never loaded into physical memory.
  • Rather than swapping the entire process into memory, we use a Lazy Swapper. It swaps the needed pages instead of entire program. The term Pager is used instead of the Lazy Swapper. A swapper manipulates entire processes, whereas a pager is concerned with the individual pages of a process
  • When a process is to be swapped in, the pager guesses which pages will be used before the process is swapped out again. Instead of swapping in a whole process, the pager brings only those pages into memory. Thus, it avoids reading into memory pages that will not be used anyway, decreasing the swap time and the amount of physical memory needed.

Leave a Reply

Your email address will not be published. Required fields are marked *