notes19 - OS Notes For April 26th and 28th Uses of VM and...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
OS Notes For April 26th and 28th Uses of VM and mmap 1. Memory map text segment of an executable or shared library. It will load pages on demand. - Faster startup - Save in the use of RAM - Shared libraries and executably files in RAM can be shared across processes 2. Memory map data segment and an executable or shared library. - Pages are loaded on demand - Pages in RAM can be shared by multiple processes as long as they are not modified - If a page is modified, a private copy is created for that process (copy on write). Advantages: - faster startup - save in the use of RAM (only pages in use are in RAM) - Multiple processes can share the same data segment pages if not modified 3. Use of VM in fork - After fork parents and child share the same RAM as long as the pages are not modified. - If a page is modified the OS creates a private copy of the page for the modifying process and modification is done in that page. Advantages: - Fast fork() - save in the use of RAM. Only modified pages are copied. 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 - Fast Allocation, No RAM is initialized to O’s until the page is modified. - Save RAM. only modified pages use RAM. 5. Shared Memory - Processes may communicate using shared memory - The processes that will communicate mmap the same file with MMAP_SHARED - Both processes share teh same RAM pages in that shared segment. Notes:
Background image of page 1

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

View Full DocumentRight Arrow Icon
- Every page in virtual memory is backed by a file. Text Segment → Executable file Data Segment → Executable file (not modified pages) → swap (modified pages) bss segment → \ stack → } swap heap → / - Memory that is backed by swap only lives during the life of the process. When the process exits the swap space used for that process is released. - The OS Keeps a reference count for each page of RAM that tells the number of
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 01/30/2012 for the course CS 354 taught by Professor Staff during the Fall '08 term at Purdue University-West Lafayette.

Page1 / 6

notes19 - OS Notes For April 26th and 28th Uses of VM and...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online