Successfully reported this slideshow.
Upcoming SlideShare
×

Virtual memory

• Full Name
Comment goes here.

Are you sure you want to Yes No

Virtual memory

1. 1. Virtual Memory Sak haw at Ali Baltis tani
2. 2. • Three memory problems: – Not enough RAM – Holes in our address space – Programs writing over each other • What is virtual memory? – Indirection – How does it solve the problems – Page Tables and Translation • Implementing Virtual Memory – Why do we store the page tables? Contents • Paging – Why we do paging ? – Page Faults – Demand Paging • Page Replacement and its Algorithms – What is Page Replacement? – FIFO Replacement Algo – Optimal Replacement Algo – LRU Algorithm
3. 3. Three Problems with Memory
4. 4. • Architecture: 32-bit address space • Programs: any byte in 32-bit address space • What if you don’t have 4GB of memory? #1: What if we don’t have enough memory? 32-bit program address space (4GB) 30-bit RAM address space (1GB) Address 0x00000000 Address 0xFFFFFFFF …to… ?? Crash if we try to access more than 1GB Q: How much memory can you access with 32- bit address? A. 230 bytes = 1GB B. 232 bytes = 4GB C. 232 words = 16GB
5. 5. • How do programs share the memory? • Where do we put them? #2: Holes in our address space? 32-bit RAM address space (4GB) 1. Program 1 and 2 fit (They use 3GB of memory, leaving 1 GB free) 2. Quit Program 1 (Program 2 uses 2GB of memory, leaving 2GB free) 3. Can’t run Program 3 (Even though we have enough free space!) Memory Fragmentation
6. 6. • Each program can access any 32-bit memory address. • What if multiple programs access the same address? – MOV [1024], AH Write to address 1024 regardless of the program that’s running • They can corrupt or crash each other: security and reliability. #3: How do we keep programs secure? 32-bit RAM address space (4GB) 1. Program 1 stores your bank balance at address 1024 2. Program 2 stores your game score at address 1024. 3. Profit? Loss? Not Good!
7. 7. • If all programs have access to the same 32-bit memory space: • How do we solve this? – Key to the problem: “same memory space” – Can we give each program its own virtual memory space? – If so, we can: • Separately map each program’s memory space to the RAM memory space • (and even move it to disk if we run out of memory) Problems with memory?
8. 8. What is Virtual Memory? ( H int: Indir ec tion)