VIRTUAL-ADDRESS SPACE Max stack heap data code 0
VIRTUAL-ADDRESS SPACE
SHARED LIBRARY USING VIRTUAL MEMORY stack stack shared shared library pages shared library heap heap data data code code
SHARED LIBRARY USING VIRTUAL MEMORY
DEMAND PAGING o Bring a page into memory only when it is needed ·Less I/O needed ·Less memory needed ·Faster response ·ore users o Page is needed =reference to it 。invalid reference→abort not-in-memory>bring to memory o Lazy swapper-never swaps a page into memory unless page will be needed Swapper that deals with pages is a pager
DEMAND PAGING Bring a page into memory only when it is needed Less I/O needed Less memory needed Faster response More users Page is needed reference to it invalid reference abort not-in-memory bring to memory Lazy swapper – never swaps a page into memory unless page will be needed Swapper that deals with pages is a pager
TRANSFER OF A PAGED MEMORY TO CONTIGUOUS DISK SPACE swap out 0☐1☐2☐3☐ program A 4古5d7 8☐9☐10☐11☐ 12☐13☐14☐15☐ program B swap in 16☐17☐18☐19☐ 20☐21☐22☐23☐ main memory
TRANSFER OF A PAGED MEMORY TO CONTIGUOUS DISK SPACE
VALID-INVALID BIT 0 With each page table entry a valid-invalid bit is associated (w→in-memory,i→not-in-memory) o Initially valid-invalid bit is set to i on all entries o Example of a page table snapshot: Frame valid-invalid bit V i i page table o During address translation,if valid-invalid bit in page table entry isI→page fault
VALID-INVALID BIT With each page table entry a valid–invalid bit is associated (v in-memory, i not-in-memory) Initially valid–invalid bit is set to i on all entries Example of a page table snapshot: During address translation, if valid–invalid bit in page table entry is I page fault v v v v i i i …. Frame # valid-invalid bit page table