6 Swapping to Disk If all the virtual memory cant fit in physical memory the OS

6 swapping to disk if all the virtual memory cant fit

This preview shows page 6 - 9 out of 10 pages.

6 Swapping to Disk If all the virtual memory can’t fit in physical memory, the OS can temporarily stash some pages on disk Can support virtual memory bigger than physical memory Silberschatz & Peterson Page Table The OS stores for each page ... Physical page number (24 bits) Cacheable bit (C) Modified bit (M) Referenced bit (R) Access permissions (Read only, Read/write) Valid/invalid (V)
Image of page 6
7 Page Faults If process accesses virtual address that maps to a page not in memory, then the OS must fetch that page from disk Since most references follow others on same page, the cost of reading from disk is amortized across many references Silberschatz & Peterson Page Replacement When read one page from disk, another page must be evicted? Which page should be replaced? Ideal: One that will be accessed furthest in future Practical heuristics: – Least recently used Least frequently used – Etc. void StringArray_read(StringArray_T s, FILE *fp) { char string[MAX_STRING_LENGTH]; s->nstrings = 0; while (fgets(string, MAX_STRING_LENGTH, fp)) { StringArray_grow(nstrings+1); s->strings[(s->nstrings)++] = strdup(string); } }
Image of page 7
8 Page Replacement (cont) Silberschatz & Peterson Working Sets Locality of reference
Image of page 8
Image of page 9

You've reached the end of your free preview.

Want to read all 10 pages?

  • One '20
  • Virtual memory

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

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes