Demand Paging

As we see in the concept of virtual memory, when executing any process, OS does not load the entire process into the main memory. It means that only some pages of a process will be loaded into the main memory at any time. Here, the demand paging is very important.

It is difficult to decide, in advance, which pages are to be kept in the main memory and which pages are to be kept in the secondary memory because we don’t know that a process will require a particular page at a specific time.

To remove this problem, the demand paging concept comes into the picture. According to demand paging, keep all pages of a process in the secondary memory until they are required. In simple words, don’t load any page of the process in the main memory until the CPU requests it.

In this way, when a page is requested for the first time, then that page will not be in the main memory. It will be loaded from secondary memory to main memory for execution.

It may or may not be found in the main memory whenever it is requested in the future. It is a page fault if it is not found in the main memory. It depends upon the page replacement algorithm. Some page replacement algorithms are

  • The theoretically optimal page replacement algorithm
  • Least recently used
  • First-in, first-out
  • Not frequently used (NFU)
  • Aging

Page Fault and page replacement algorithms will be discussed later in lectures.


The degree of multi-programming is increased.

Problems in Demand Paging

  Page fault may increase, which will cause system performance to decrease.