v10stanford.edu-Demand_Paging

v10stanford.edu-Demand_Paging - Demand Paging http/w w...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
http://w w w .stanford.edu/~ouster/cgi-bin/cs140-w inter12/lecture.php?topic=paging January 11, 2012 Demand Paging Demand Paging Lecture Notes for CS 140 Winter 2012 John Ousterhout Readings for this topic from Operating System Concepts : Sections 9.1-9.2, Sections 9.4-9.5. Demand paging : not all of a process's virtual address space needs to be loaded in main memory at any given time. Each page can be either: In memory (physical page frame) On disk ( backing store ) Page Faults What happens when a process references a page that is in the backing store? For pages in the backing store, clear the exists bit in the page table entries. If exists is not set, then a reference to the page causes a trap to the operating system. These traps are called page faults . To handle a page fault, the operating system Finds a free page frame in memory Reads the page in from backing store to the page frame Updates the page table entry, setting exists Resumes execution of the thread How does the OS figure out which page generated the fault? x86: hardware saves the virtual address that caused the fault (CR2 register) On some platforms OS gets only address of faulting instruction, must simulate the instruction and try every address to find the one that generated the fault Restarting process execution after a page fault is tricky, since the fault may have occurred in the middle of an instruction. If instructions are idempotent, just restart the faulting instruction (hardware saves instruction address during page fault). Non-idempotent instructions are more difficult to restart:
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/02/2012 for the course CS 140 taught by Professor Rosenblum during the Winter '08 term at Stanford.

Page1 / 4

v10stanford.edu-Demand_Paging - Demand Paging http/w w...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online