Byu cs 345 virtual memory 9 virtual memory principle

This preview shows page 9 - 17 out of 93 pages.

BYU CS 345 Virtual Memory 9 Virtual Memory Principle of Locality – A program tends to reference the same items - even if same item not used, nearby items will often be referenced Resident Set – Those parts of the program being actively used (remaining parts of program on disk) Thrashing – Constantly needing to get pages off secondary storage happens if the O.S. throws out a piece of memory that is about to be used can happen if the program scans a long array – continuously referencing pages not used recently O.S. must watch out for this situation! Virtual Memory
Image of page 9

Subscribe to view the full document.

BYU CS 345 Virtual Memory 10 Paging Hardware Use page number as a index into the page table, which then contains the physical frame holding that page Typical Flag bits: Present, Accessed, Modified, various protection-related bits Paging
Image of page 10
BYU CS 345 Virtual Memory 11 More Paging Hardware Full page tables can be very large 4G space with 4K pages = 1M entries some systems put page tables in virtual address space Multilevel page tables top level page table has a Present bit to indicate entire range is not valid second level table only used if that part of the address space is used second level tables can also be used for shared libraries Paging
Image of page 11

Subscribe to view the full document.

BYU CS 345 Virtual Memory 12 Flags / Frame # Frame<<6 User Page Table + Two-Level Paging System RPTE # UPTE # Frame Offset 15 11 10 6 5 0 Virtual Address RPT Flags / UPT # Root Page Table One per process + LC-3 Main Memory Offset 15 6 5 0 Physical Address Paging
Image of page 12
BYU CS 345 Virtual Memory 13 MMU’s MMU’s used to sit between the CPU and bus now they are typically integrated into the CPU Page tables originally implemented in special very fast registers now they are stored in normal memory entries are cached in fast registers as they are used Optional features separate page tables for each processor mode read/write access control, referenced/dirty bits Paging
Image of page 13

Subscribe to view the full document.

BYU CS 345 Virtual Memory 14 More Paging Hardware To minimize the performance penalty of address translation, most modern CPUs include an on-chip memory management unit (MMU) and maintain a table of recently used virtual-to-physical translations, called a Translation Lookaside Buffer (TLB). Paging
Image of page 14
BYU CS 345 Virtual Memory 15 Segmentation Programmer sees memory as a set of multiple segments, each with a separate address space Growing data structures easier to handle O.S. can expand or shrink segment Can alter the one segment without modifying other segments Easy to share a library share one segment among processes Easy memory protection can set values for the entire segment Segmentation
Image of page 15

Subscribe to view the full document.

BYU CS 345 Virtual Memory 16 Segmentation (continued…) Implementation: have a segment table for each process similar to one-level paging method status – present, modified, location, size Combine with paging: No external fragmentation easier to manage memory since all items are the same size Some processors have both (386)
Image of page 16
Image of page 17
You've reached the end of this preview.
  • Winter '12
  • EricMercer
  • Virtual memory, main memory, page faults, BYU CS

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern