Virtual Memory
-
Upload
arthur-diaz -
Category
Documents
-
view
11 -
download
0
description
Transcript of Virtual Memory
![Page 1: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/1.jpg)
Virtual Memory
Operating Systems
Lecture # 8
![Page 2: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/2.jpg)
Multi-tasking OS
OS
Excel
MS Word
Outlook0x0000
0x7000
0x4000
0x8000
0x9000
![Page 3: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/3.jpg)
Virtual Memory
Protection– A process should be able to reference its
own “address space” Abstraction
– Every process thinks it owns the entire RAM e.g. 0x0000 to 0x9000
• Makes it easier for the compiler to generate object (assembly) code
![Page 4: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/4.jpg)
Virtual Memory
Virtual Memory manager translates the virtual (or fake) addresses
Compiler
virtual address
CPU
Assembly language Load Store
Translate
Virtual -> Actual
Physicaladdress RAM
Address Translation (MMU)
![Page 5: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/5.jpg)
Memory Manager
Compiler
virtual address
CPU
Assembly language Load Store
legal addr?Illegal?
Physicaladdress
RAMAddress Translation (MMU)
Illegal Access Exception
Data
![Page 6: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/6.jpg)
Virtual Memory
Virtual memory makes the compiler job much simpler – Sequential addresses– MMU maps and remaps the virtual addresses to
actual memory If some part of the memory is not used
– Memory may be multiplexed between processes – Just as the process abstraction permits the CPU
to be multiplexed between processes
![Page 7: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/7.jpg)
Memory Translation
Hardware provides two registers and an adder
Keep a base register to remap addresses Add the current address to the base register
address Protection: Check against an upper bound
![Page 8: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/8.jpg)
Memory Translation
0x0000
Process A0x3000
0x4000
process A
read 0x3000 read 0x2000
0x9000
Base: 0x4000Bound:0x9000
MMU
![Page 9: Virtual Memory](https://reader036.fdocuments.in/reader036/viewer/2022072015/56812fc9550346895d9549ce/html5/thumbnails/9.jpg)
Virtual MemoryVirtual memory
Physical Memory
0
0
0
0OS
MMU
0