Lecture17-virtual-memory

Lecture17-virtual-me - 1 CS 3214 Computer Systems Godmar Back Lecture 17 Announcements • Project 4 due Nov 2 • Exercise 6 due today CS 3214

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1 CS 3214 Computer Systems Godmar Back Lecture 17 Announcements • Project 4 due Nov 2 • Exercise 6 due today CS 3214 Fall 2011 MEMORY MANAGEMENT Part 3 CS 3214 Fall 2011 Virtual Memory • Is not a “kind” of memory • Is a technique that combines one or more of the following concepts: – Address translation (always) CS 3214 Fall 2011 Address translation (always) – Paging from/to disk (usually) – Protection (usually) • Can make storage that isn’t physical DRAM appear as though it were Key goals for Virtual Memory • Virtualization 1. Maintain illusion that each process has entire memory to itself • Per-process address spaces 2. Allow processes access to more memory than is CS 3214 Fall 2011 really in the machine (or: sum of all memory used by all processes > physical memory) • Makes DRAM a cache for disk • Protection 1. make sure there’s no way for any process to access another process’s data unintentionally 2. protect system-internal data/kernel data Address Translation • Provides a way for OS to interpose on memory accesses • OS maintains for each process a mapping { virtual addresses } → { physical addresses } in a per-process page table – Which virtual addresses are valid (depends on process – Which virtual addresses are valid (depends on process memory layout) – Where they map to (depends on availability of physical memory) – What kind of accesses are allowed (read/write/execute) • OS manages page tables – Based on input/commands from user processes – Based on resource management decisions CS 3214 Fall 2011 2 Address Translation & TLB Virtual Address TLB Lookup Check Permissions Page Table Walk miss hit restart instruction done in hardware done in OS software done in software or hardware CS 3214 Fall 2011 Check Permissions Physical Address Page Fault Exception “Protection Fault” Page Fault Exception “Page Not Present” TLB Reload Send SIGSEGV To Process page present else ok denied Load Page Switching Address Spaces • Following slides show how virtual-to-physical mappings change on mode switch/context switch/mode switch sequence – Show a bit of kernel-level implementation detail • In mult threaded case context switch may or In multi-threaded case, context switch may or may not involve a change in current address space • Costs of switching address spaces adds to context switch cost – Mainly opportunity cost: need to flush TLB & then take the misses to repopulate it CS 3214 Fall 2011 Process 1 Active in user mode kbss kheap C0400000 FFFFFFFF 1 GB user (2) P1 ustack (1) CS 3214 Fall 2011 kernel kernel kernel kernel ucode (1) kcode kdata C0000000 3 GB used free user (1) user (1) udata (1) user (1) user (2) user (2) access possible in user mode Process 1 Active in kernel mode kbss kheap C0400000 FFFFFFFF 1 GB user (2) access requires kernel mode P1 CS 3214 Fall 2011 ustack (1) kernel kernel kernel kernel ucode (1) kcode kdata C0000000 3 GB used free user (1) user (1) udata (1) user (1)...
View Full Document

This note was uploaded on 12/31/2011 for the course CS 3214 taught by Professor Staff during the Fall '11 term at Virginia Tech.

Page1 / 6

Lecture17-virtual-me - 1 CS 3214 Computer Systems Godmar Back Lecture 17 Announcements • Project 4 due Nov 2 • Exercise 6 due today CS 3214

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