L18-4up

L18-4up - Virtual Machines Review: Virtual Memory CPU...

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

View Full Document Right Arrow Icon
L18 – Virtual Machines 1 6.004 – Fal 2010 11/9/10 Virtual Machines Lab #6 due Thursday L18 – Virtual Machines 2 6.004 – Fal 2010 11/9/10 Review: Virtual Memory Goal: create illusion of large virtual address space divide address into (VPN,o f set), map to (PPN,o f set) or page fault use high address bits to select page: keep related data on same page use cache ( TLB ) to speed up mapping mechanism—works well long disk latencies : keep working set in physical memory, use write-back PAGEMAP X X X D R Virtual Memory Physical Memory PPN CPU RAM MMU VA PA L18 – Virtual Machines 3 6.004 – Fal 2010 11/9/10 MMU Address Translation Typical Multi-level approach 32 32-bit virtual address 3 Page fault (handled by SW) 1 Look in TLB: VPN ! PPN cache Usually implemented as a small (16- to 64-entry) fully-associative cache 2 Data 20 12 PTBL D R PPN virtual page number 20 12 L18 – Virtual Machines 4 6.004 – Fal 2010 11/9/10 Example I 0 1 2 -- 0 -- 0 1 4 -- 0 -- 1 1 0 1 1 1 -- 0 -- -- 0 -- -- 0 -- -- 0 -- -- 0 -- -- 0 -- 1 1 7 1 1 6 1 1 5 0 1 3 Setup: 256 bytes/page (2 8 ) 16 virtual pages (2 4 ) 8 physical pages (2 3 ) 12-bit VA (4 vpn, 8 o f set) 11-bit PA (3 ppn, 8 o f set) LRU page: VPN = 0xE LD(R31,0x2C8,R0): VA = 0x2C8, PA = _______ 16-entry Page Table 8-page Phys. Mem. D R PPN VPN 0x4 VPN 0x5 VPN 0x0 VPN 0xF VPN 0x2 VPN 0xE VPN 0xD VPN 0xC 0x000 0x0FC 0x100 0x1FC 0x200 0x2FC 0x300 0x3FC 0x400 0x4FC 0x500 0x5FC 0x600 0x6FC 0x700 0x7FC 0x4C8 VPN = 0x2 ! PPN = 0x4 0 1 2 3 4 5 6 7 8 9 A B C D E F 8 4 VA o f set VPN 8 3 PA PPN
Background image of page 1

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

View Full DocumentRight Arrow Icon
L18 – Virtual Machines 5 6.004 – Fal 2010 11/9/10 Example II 0 1 2 -- 0 -- 0 1 4 -- 0 -- 1 1 0 1 1 1 -- 0 -- -- 0 -- -- 0 -- -- 0 -- -- 0 -- 1 1 7 1 1 6 0 1 3 Setup: 256 bytes/page (2 8 ) 16 virtual pages (2 4 ) 8 physical pages (2 3 ) 12-bit VA (4 vpn, 8 o f set) 11-bit PA (3 ppn, 8 o f set) LRU page: VPN = 0xE ST(BP,-4,SP), SP = 0x604 VA = 0x600, PA = _______ 16-entry Page Table 8-page Phys. Mem. D R PPN 1 1 5 -- 0 -- VPN 0x4 VPN 0x5 VPN 0x0 VPN 0xF VPN 0x2 VPN 0xD VPN 0xC 0x000 0x0FC 0x100 0x1FC 0x200 0x2FC 0x300 0x3FC 0x400 0x4FC 0x500 0x5FC 0x600 0x6FC 0x700 0x7FC VPN 0x6 0 1 2 3 4 5 6 7 8 9 A B C D E F 0x500 VPN = 0x6 ! Not resident, it ` s on disk ! Choose page to replace (LRU = 0xE) ! D[0xE] = 1, so write 0x500-0x5FC to disk ! Mark VPN 0xE as no longer resident ! Read in page 0x6 from disk into 0x500-0x5FC ! Set up page map for VPN 0x6 = PPN 0x5 ! PA = 0x500 ! This is a write so set D[0x6] = 1 L18 – Virtual Machines 6 6.004 – Fal 2010 11/9/10 Contexts A context is an entire set of mappings from VIRTUAL to PHYSICAL page numbers as speci±ed by the contents of the page map: We might like to support multiple VIRTUAL to PHYSICAL Mappings and, thus, multiple Contexts. PAGEMAP X X X D R Virtual Memory Physical Memory THE BIG IDEA: Several programs, each with their own context, may be simultaneously loaded into main memory! l Context switch z : reload the page map! Virtual Memory 1 Virtual Memory 2 Physical Memory map map L18 – Virtual Machines 7 6.004 – Fal 2010 11/9/10 Power of Contexts: Sharing a CPU 1. TIMESHARING among several programs -- • Separate context for each program • OS loads appropriate context into pagemap when switching among pgms 2. Separate context for Operating System l Kernel z (eg, interrupt handlers). ..
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 document was uploaded on 03/07/2011.

Page1 / 6

L18-4up - Virtual Machines Review: Virtual Memory CPU...

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