Allocate zero-initialized memory

Allocate zero-initialized memory - get a page fault • The...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
4. Allocate zero-initialized memory. It is used to allocate space for bss, stack and sbrk() When allocating memory using sbrk or map with the MMAP_ANON flag, all the VM pages in this mapping will map to a single page in RAM that has zeroes and that is read only. When a page is modified the OS creates a copy of the page (copy on write) and retries the modifying instruction This allows fast allocation. No RAM is initialized to O’s until the page is modified This also saves RAM. only modified pages use RAM.
Image of page 1

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

View Full Document Right Arrow Icon
4. Allocate zero-initialized memory. This is implemented by making the entries in the same page table point to a page with 0s and making the pages read only. An instruction that tries to modify the page will
Image of page 2
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: get a page fault. • The page fault allocates another physical page with 0’s and updates the page table to point to it. • The instruction is retried and the program continues as it never happened. 4. Allocate zero-initialized memory. . Physical Memory Parent’s Virtual Memory 0’s page A 0’s page B 0’s page C 0’s After allocating zero initialized memory with sbrk or mmap, all pages point to a single page with zeroes 4. Allocate zero-initialized memory. . Physical Memory Parent’s Virtual Memory 0’s page A 0’s page B X page C 0’s When a page is modified, the page creates a copy of the page and the modification is done in the copy. page B X...
View Full Document

{[ 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