Demand paging

Demand paging

In computer operating systems, demand paging (as opposed to anticipatory paging) is an application of virtual memory. In a system that uses demand paging, the operating system copies a disk page into physical memory only if an attempt is made to access it (i.e., if a page fault occurs). It follows that a process begins execution with none of its pages in physical memory, and many page faults will occur until most of a process's working set of pages is located in physical memory. This is an example of lazy loading techniques.

Contents

Advantages

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 context 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.
  • Does not need extra hardware support than what paging needs, since protection fault can be used to get page fault.

Disadvantages

  • Individual programs face extra latency when they access a page for the first time. So demand paging may have lower performance than anticipatory paging algorithms such as prepaging.
  • Programs running on low-cost, low-power embedded systems may not have a memory management unit that supports page replacement.
  • Memory management with page replacement algorithms becomes slightly more complex.
  • Possible security risks, including vulnerability to timing attacks; see Percival 2005 Cache Missing for Fun and Profit (specifically the virtual memory attack in section 2).

Basic concept

Demand paging follows that pages should only be brought into memory if the executing process demands them. This is often referred to as lazy evaluation as only those pages demanded by the process are swapped from secondary storage to main memory. Contrast this to pure swapping, where all memory for a process is swapped from secondary storage to main memory during the process startup.

When a process is to be swapped into main memory for processing, the pager guesses which pages will be used prior to the process being swapped out again. The pager will only load these pages into memory. This process avoids loading pages that are unlikely to be used and focuses on pages needed during the current process execution period. Therefore, not only is unnecessary page load during swapping avoided but we also try to preempt which pages will be needed and avoid loading pages during execution.

Commonly, to achieve this process a page table implementation is used. The page table maps logical memory to physical memory. The page table uses a bitwise operator to mark if 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 a page-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 to page 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.

See also

References

  • Tanenbaum, Andrew S. Operating Systems: Design and Implementation (Second Edition). New Jersey: Prentice-Hall 1997.

Wikimedia Foundation. 2010.

Игры ⚽ Нужна курсовая?

Look at other dictionaries:

  • demand paging — UK [dɪˈmɑːnd ˌpeɪdʒɪŋ] US [dɪˈmænd ˌpeɪdʒɪŋ] noun [uncountable] computing a piece of software that makes extra memory available when the computer needs to run more programs than normal Thesaurus: computer softwarehyponym …   Useful english dictionary

  • demand paging — UK [dɪˈmɑːnd ˌpeɪdʒɪŋ] / US [dɪˈmænd ˌpeɪdʒɪŋ] noun [uncountable] computing a piece of software that makes extra memory available when the computer needs to run more programs than normal …   English dictionary

  • demand paging —    A common form of virtual memory management in which pages of information are read into memory from disk only when required by the program.    See also swapping …   Dictionary of networking

  • Paging — This article is about computer virtual memory. For the wireless communication devices, see Pager . Bank switching is also called paging. Page flipping is also called paging. For calling people in a public place see Public address. In computer… …   Wikipedia

  • Paging — Als Paging (vgl. engl. page Speicherseite) oder deutsch Kachelverwaltung[1] bezeichnet man die Methode der Arbeitsspeicher Verwaltung per Seitenadressierung durch Betriebssysteme. Gelegentlich wird der Begriff Paging synonym mit der gesamten… …   Deutsch Wikipedia

  • Kachelverwaltung — Als Paging (vgl. engl. page Speicherseite) oder deutsch Kachelverwaltung bezeichnet man die Methode der Arbeitsspeicher Verwaltung per Seitenadressierung durch Betriebssysteme. Dabei wird häufig aus Effizienzgründen die sogenannte Memory… …   Deutsch Wikipedia

  • Thrashing — Als Paging (vgl. engl. page Speicherseite) oder deutsch Kachelverwaltung bezeichnet man die Methode der Arbeitsspeicher Verwaltung per Seitenadressierung durch Betriebssysteme. Dabei wird häufig aus Effizienzgründen die sogenannte Memory… …   Deutsch Wikipedia

  • Working Set — Als Paging (vgl. engl. page Speicherseite) oder deutsch Kachelverwaltung bezeichnet man die Methode der Arbeitsspeicher Verwaltung per Seitenadressierung durch Betriebssysteme. Dabei wird häufig aus Effizienzgründen die sogenannte Memory… …   Deutsch Wikipedia

  • Workingset — Als Paging (vgl. engl. page Speicherseite) oder deutsch Kachelverwaltung bezeichnet man die Methode der Arbeitsspeicher Verwaltung per Seitenadressierung durch Betriebssysteme. Dabei wird häufig aus Effizienzgründen die sogenannte Memory… …   Deutsch Wikipedia

  • Kernel (computer science) — In computer science, the kernel is the central component of most computer operating systems (OS). Its responsibilities include managing the system s resources (the communication between hardware and software components). As a basic component of… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”