DOC PREVIEW
UMD CMSC 412 - Chapter 8 Virtual Memory

This preview shows page 1-2-3-4-24-25-26-50-51-52-53 out of 53 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 53 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Virtual MemoryProcess ExecutionLocality and Virtual MemorySupport Needed for Virtual MemoryPagingSlide 6Page Table StructureAddress Translation in a Paging SystemSharing PagesPage Tables and Virtual MemoryMultilevel Page TablesSegmentationAddress Translation in a Segmentation SystemSegmentation: commentsSharing in Segmentation SystemsCombined Segmentation and PagingAddress Translation in a (simple) combined Segmentation/Paging SystemSimple Combined Segmentation and PagingOperating System SoftwareFetch PolicyPlacement policyReplacement PolicySlide 23Slide 24Basic algorithms for the replacement policyThe LRU PolicyNote on counting page faultsImplementation of the LRU PolicyThe FIFO PolicyComparison of FIFO with LRUThe Clock PolicyThe Clock Policy: an exampleComparison of Clock with FIFO and LRUSlide 34Page BufferingSlide 36Cleaning PolicySlide 38Resident Set SizeSlide 40Replacement ScopeFixed allocation + Local scopeFixed allocation + Global scopeVariable allocation + Global scopeVariable allocation + Local scopeThe Working Set StrategyThe Working Set StrategySlide 48Slide 49The Page-Fault Frequency StrategyLoad ControlSlide 52Process Suspension1Virtual MemoryVirtual MemoryChapter 8Chapter 82Process ExecutionProcess ExecutionThe OS brings into main memory only a few pieces of the program (including its starting point)Each page/segment table entry has a present bit that is set only if the corresponding piece is in main memoryThe resident set is the portion of the process that is in main memoryAn interrupt (memory fault) is generated when the memory reference is on a piece not present in main memory3Locality and Virtual MemoryLocality and Virtual MemoryPrinciple of locality of references: memory references within a process tend to clusterHence: only a few pieces of a process will be needed over a short period of timePossible to make intelligent guesses about which pieces will be needed in the futureThis suggests that virtual memory may work efficiently (ie: trashing should not occur too often)4Support Needed forSupport Needed forVirtual MemoryVirtual MemoryMemory management hardware must support paging and/or segmentation OS must be able to manage the movement of pages and/or segments between secondary memory and main memoryWe will first discuss the hardware aspects; then the algorithms used by the OS5PagingPagingEach page table entry contains a present bit to indicate whether the page is in main memory or not.If it is in main memory, the entry contains the frame number of the corresponding page in main memoryIf it is not in main memory, the entry may contain the address of that page on disk or the page number may be used to index another table (often in the PCB) to obtain the address of that page on diskTypically, each process has its own page table6PagingPagingA modified bit indicates if the page has been altered since it was last loaded into main memoryIf no change has been made, the page does not have to be written to the disk when it needs to be swapped outOther control bits may be present if protection is managed at the page level a read-only/read-write bit protection level bit: kernel page or user page (more bits are used when the processor supports more than 2 protection levels)7Page Table StructurePage Table StructurePage tables are variable in length (depends on process size)then must be in main memory instead of registersA single register holds the starting physical address of the page table of the currently running process8Address Translation in a Paging SystemAddress Translation in a Paging System9Sharing PagesSharing PagesIf we share the same code among different users, it is sufficient to keep only one copy in main memoryShared code must be reentrant (ie: non self-modifying) so that 2 or more processes can execute the same codeIf we use paging, each sharing process will have a page table who’s entry points to the same frames: only one copy is in main memoryBut each user needs to have its own private data pages10Page Tables and Virtual MemoryPage Tables and Virtual MemoryMost computer systems support a very large virtual address space32 to 64 bits are used for logical addressesIf (only) 32 bits are used with 4KB pages, a page table may have 2^{20} entriesThe entire page table may take up too much main memory. Hence, page tables are often also stored in virtual memory and subjected to paging When a process is running, part of its page table must be in main memory (including the page table entry of the currently executing page)11Multilevel Page TablesMultilevel Page TablesSince a page table will generally require several pages to be stored. One solution is to organize page tables into a multilevel hierarchy When 2 levels are used (ex: 386, Pentium), the page number is split into two numbers p1 and p2p1 indexes the outer paged table (directory) in main memory who’s entries points to a page containing page table entries which is itself indexed by p2. Page tables, other than the directory, are swapped in and out as needed12SegmentationSegmentationTypically, each process has its own segment tableSimilarly to paging, each segment table entry contains a present bit and a modified bitIf the segment is in main memory, the entry contains the starting address and the length of that segmentOther control bits may be present if protection and sharing is managed at the segment levelLogical to physical address translation is similar to paging except that the offset is added to the starting address (instead of being appended)13Address Translation in a Address Translation in a Segmentation SystemSegmentation System14Segmentation: commentsSegmentation: commentsIn each segment table entry we have both the starting address and length of the segmentthe segment can thus dynamically grow or shrink as neededaddress validity easily checked with the length fieldBut variable length segments introduce external fragmentation and are more difficult to swap in and out...It is natural to provide protection and sharing at the segment level since segments are visible to the programmer (pages are not)Useful protection bits in segment table entry:read-only/read-write bit Supervisor/User bit15Sharing in Segmentation SystemsSharing in Segmentation SystemsSegments are shared when entries in the segment tables of 2 different processes point to the same


View Full Document

UMD CMSC 412 - Chapter 8 Virtual Memory

Documents in this Course
Security

Security

65 pages

Deadlocks

Deadlocks

22 pages

Set 2

Set 2

70 pages

Project 2

Project 2

21 pages

Load more
Download Chapter 8 Virtual Memory
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chapter 8 Virtual Memory and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chapter 8 Virtual Memory 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?