Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

Demand paging

From Wikipedia, the free encyclopedia
Method of virtual memory management
This article includes alist of references,related reading, orexternal links,but its sources remain unclear because it lacksinline citations. Please helpimprove this article byintroducing more precise citations.(June 2009) (Learn how and when to remove this message)

Incomputeroperating systems,demand paging (as opposed toanticipatory paging) is a method ofvirtual memory management. In a system that uses demand paging, the operating system copies a diskpage into physical memory only when an attempt is made to access it and that page is not already in memory (i.e., if apage fault occurs). It follows that aprocess begins execution with none of its pages in physical memory, and triggers many page faults until most of itsworking set of pages are present in physical memory. This is an example of alazy loading technique.

Basic concept

[edit]

Demand paging only brings pages into memory when an executing process demands them. This is often referred to aslazy loading, as only those pages demanded by the process are swapped fromsecondary storage tomain memory. 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.

Commonly, to achieve this process amemory management unit is used. The memory management unit mapslogical memory tophysical memory. Entries in the memory management unit include a bit that indicates whether a page is valid or invalid. A valid page is one that currently resides in main memory. An invalid page is one that currently resides in secondary memory. When a process tries to access a page, the following steps are generally followed:

  • Attempt to access page.
  • If page is valid (in memory) then continue processing instruction as normal.
  • If page is invalid then apage-fault trap occurs.
  • Check if the memory reference is a valid reference to a location on secondary memory. If not, the process is terminated (illegal memory access). Otherwise, we have topage in the required page.
  • Schedule disk operation to read the desired page into main memory.
  • Restart the instruction that was interrupted by the operating system trap.

Advantages

[edit]

Demand paging, as opposed to loading all pages immediately:

  • Only loads pages that are demanded by the executing process.
  • As there is more space in main memory, more processes can be loaded, reducing thecontext switching time, which utilizes large amounts of resources.
  • Less loading latency occurs at program startup, as less information is accessed from secondary storage and less information is brought into main memory.
  • As main memory is expensive compared to secondary memory, this technique helps significantly reduce thebill of material (BOM) cost in smart phones for example. Symbian OS had this feature.

Disadvantages

[edit]

See also

[edit]
Wikisource has original text related to this article:

References

[edit]
  • Tanenbaum, Andrew S.Operating Systems: Design and Implementation (Second Edition). New Jersey: Prentice-Hall 1997.
Hardware
Virtual memory
Memory segmentation
Memory allocator
Manual memory management
Garbage collection
Memory safety
Issues
Other
Retrieved from "https://en.wikipedia.org/w/index.php?title=Demand_paging&oldid=1286568621"
Category:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp