virtual memory
play

Virtual Memory Hakim Weatherspoon CS 3410 Computer Science - PowerPoint PPT Presentation

Virtual Memory Hakim Weatherspoon CS 3410 Computer Science Cornell University [Weatherspoon, Bala, Bracy, McKee, and Sirer] Where are we now and where are we going? How many programs do you run at once? a) 1 b) 2 c) 3-5


  1. Virtual Memory Hakim Weatherspoon CS 3410 Computer Science Cornell University [Weatherspoon, Bala, Bracy, McKee, and Sirer]

  2. Where are we now and where are we going? • How many programs do you run at once? • a) 1 • b) 2 • c) 3-5 • d) 6-10 • e) 11+ 2

  3. Big Picture: Multiple Processes How to run multiple processes? • Time-multiplex a single CPU core (multi- tasking) • Web browser, skype, office, … all must co-exist • Many cores per processor (multi-core) or many processors (multi-processor) • Multiple programs run simultaneously 3

  4. Processor & Memory • CPU address/data bus... • … routed through caches • … to main memory 0xfff…f CPU  Simple, fast, but… 0x7ff…f Stack $$ Heap Data Text 0x000…0 Memory 4

  5. Multiple Processes • Q: What happens when another program is executed concurrently on another 0xfff…f processor? CPU 0x7ff…f Stack Stack $$ $$ Heap Heap CPU Data Data Text Text 0x000…0 Memory 5

  6. Multiple Processes • Q: Can we relocate second program? 0xfff…f CPU 0x7ff…f Stack Stack $$ $$ Heap Heap CPU Data Data Text Text 0x000…0 Memory 6

  7. Big Picture: (Virtual) Memory A 3 Process 1 B 2 C 1 Give each process an D 0 illusion that it has exclusive access to entire main memory E 3 Process 2 F 2 G 1 H 0 7

  8. But In Reality… 14 D 13 12 Process 1 E 11 10 9 C 8 7 B 6 G H 5 4 Process 2 A 3 2 F 1 0 Physical Memory 8

  9. How do we create the illusion? 14 D 13 12 A 3 Process 1 E 11 B 2 10 C 1 9 C D 0 8 7 B 6 G H 5 E 3 4 Process 2 F 2 A 3 G 1 2 H 0 F 1 0 Physical Memory 9

  10. How do we create the illusion? 14 D 13 12 A 3 Process 1 E 11 B 2 10 C 1 9 C D 0 All problems in computer science can be solved by another level of 8 indirection. 7 B – David Wheeler 6 G H 5 E 3 4 Process 2 F 2 A 3 G 1 2 H 0 F 1 0 Physical Memory 10

  11. How do we create the illusion? 14 D 13 12 A 3 Process 1 E 11 B 2 10 Map virtual C 1 Physical address 9 C address to D 0 8 physical address 7 Virtual address B Memory 6 G management unit H 5 (MMU) takes care E 3 of the mapping 4 Process 2 F 2 A 3 G 1 2 H 0 F 1 Virtual Memory 0 (just a concept; does not exist physically) Physical Memory 11

  12. How do we create the illusion? 14 Process 1 wants to D 13 access data C 12 Process 1 thinks it A 3 Process 1 E 11 is stored at addr 1 B 2 So CPU generates 10 C 1 addr 1 Physical address 9 C D 0 This addr is 8 intercepted by 7 Virtual address B MMU 6 G MMU knows this H 5 is a virtual addr E 3 MMU looks at the 4 Process 2 F 2 mapping A 3 G Virtual addr 1 -> 1 2 Physical addr 9 H 0 Data at Physical F 1 addr 9 is sent to Virtual Memory 0 CPU (just a concept; does not exist physically) And that data is Physical Memory 12 indeed C!!!

  13. How do we create the illusion? 14 D 13 12 A 3 Process 1 E 11 B 2 10 Map virtual C 1 9 C address to D 0 8 physical address 7 B Memory 6 G management unit H 5 (MMU) takes care E 3 of the mapping 4 Process 2 F 2 3 G 1 2 H 0 1 Virtual Memory 0 A F Physical Memory 13 Disk

  14. Big Picture: (Virtual) Memory • From a process’s perspective – Hidden from Process A 3 Process 1 B 2 C C 1 D 0 Physical Memory Virtual Memory  Process only sees the virtual memory  Contiguous memory 14

  15. Big Picture: (Virtual) Memory • From a process’s perspective – Hidden from Process A 3 Process 1 B 2 C C 1 D 0 Physical Memory Virtual Memory • Process only sees the virtual memory  Contiguous memory  No need to recompile - only mappings need to be updated 15

  16. Big Picture: (Virtual) Memory • From a process’s perspective – Hidden from Process C A 3 Process 1 B 2 C 1 D 0 Physical Memory Virtual Memory  Process only sees the virtual memory  Contiguous memory  No need to recompile - only mappings need to be updated 16

  17. Big Picture: (Virtual) Memory • From a process’s perspective – Hidden from Process A 3 Process 1 B 2 C 1 D 0 Physical Memory Virtual Memory  Process only sees the virtual memory C Disk  Contiguous memory  No need to recompile - only mappings need to be updated  When run out of memory, MMU maps data on disk in a transparent manner 17

  18. Next Goal • How does Virtual Memory work? • i.e. How do we create the “map” that maps a virtual address generated by the CPU to a physical address used by main memory? 18

  19. Next Goal (after spring break!) • How does Virtual Memory work? • i.e. How do we create the “map” that maps a virtual address generated by the CPU to a physical address used by main memory? 19

  20. Virtual Memory Agenda What is Virtual Memory? How does Virtual memory Work? • Address Translation • Overhead • Paging • Performance 20

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend