Demand paging
In computer operating systems, demand paging (as opposed to anticipatory paging) is a method of virtual memory management.[src] In a system that uses demand paging, the operating system copies a disk page into physical memory only when an attempt is made to access it and that page is not already in memory (i.e., if a page fault occurs).[src] It follows that a process begins execution with none of its pages in physical memory, and triggers many page faults until most of its working set of pages are present in physical memory.[src] This is an example of a lazy loading technique.[src]
In computer operating systems, demand paging (as opposed to anticipatory paging) is a method of virtual memory management.[src] In a system that uses demand paging, the operating system copies a disk page into physical memory only when an attempt is made to access it and that page is not already in memory (i.e., if a page fault occurs).[src] It follows that a process begins execution with none of its pages in physical memory, and triggers many page faults until most of its working set of pages are present in physical memory.[src] This is an example of a lazy loading technique.[src] ==Basic concept== Demand paging only brings pages into memory when an executing process demands them.[src] This is often referred to as lazy loading, as only those pages demanded by the process are swapped from secondary storage to main memory.[src] Contrast this to pure swapping, where all memory for a process is swapped from secondary storage to main memory when the process starts up or resumes execution.[src] Commonly, to achieve this process a memory management unit is used.[src] The memory management unit maps logical memory to physical memory.[src] Entries in the memory management unit include a bit that indicates whether a page is valid or invalid.[src] A valid page is one that currently resides in main memory.[src] An invalid page is one that currently resides in secondary memory.[src] When a process tries to access a page, the following steps are generally followed: Attempt to access page.[src] If page is valid (in memory) then continue processing instruction as normal.[src] If page is invalid then a page-fault trap occurs.[src] Check if the memory reference is a valid reference to a location on secondary memory.[src] If so, we have to page in the required page.[src] Otherwise, the process is terminated (illegal memory access).[src] Schedule disk operation to read the desired page into main memory.[src] Restart the instruction that was interrupted by the operating system trap.[src] ==Advantages== Demand paging, as opposed to loading all pages immediately: Only loads pages that are demanded by the executing process.[src] As there is more space in main memory, more processes can be loaded, reducing the context switching time, which utilizes large amounts of resources.[src] Less loading latency occurs at program startup, as less information is accessed from secondary storage and less information is brought into main memory.[src] As main memory is expensive compared to secondary memory, this technique helps significantly reduce the bill of material (BOM) cost in smart phones for example.[src] Symbian OS had this feature.[src] ==Disadvantages== Individual programs face extra latency when they access a page for the first time.[src] Low-cost, low-power embedded systems may not have a memory management unit that supports page replacement.[src] Memory management with page replacement algorithms becomes slightly more complex.[src] Possible security risks, including vulnerability to timing attacks; see (specifically the virtual memory attack in section 2).[src] Thrashing which may occur due to repeated page faults.[src] ==See also== Lazy evaluation Page cache Memory management Virtual memory ==References== Tanenbaum, Andrew S.[src] Operating Systems: Design and Implementation (Second Edition).[src] New Jersey: Prentice-Hall 1997.[src]
37 sentences · 37 cited inline · 0 references stored
References
No reference rows published for this article.
Cite this article
MLA
"Demand paging." encyclopegia.org, 2026, https://encyclopegia.org/wiki/demand-paging. Accessed 30 November 2026.
Chicago
"Demand paging." encyclopegia.org. Accessed November 30, 2026. https://encyclopegia.org/wiki/demand-paging.
APA
encyclopegia.org. (2026). Demand paging. Retrieved November 30, 2026, from https://encyclopegia.org/wiki/demand-paging
Accessed November 30, 2026 · CC BY-SA 4.0 · citation page · JSON