lecture 13 Flashcards
Virtual memory, address translation, and putting it all together!
MMU
memory management unit
role of MMU
responsible for translating a virtual address to a physcial address in DRAM
relationship between MMU and CPU
MMU is a program inside CPU
cpu –> holds virtual address located in DRAM in a register
mmu –> translates this address held in the register to physical address in DRAM
relationship between MMU and DRAM
mmu –> mmu page table, array of PTEs that map virtual pages to page frames
page frames –> cached into physical memory (DRAM)
- loaded into DRAM
How does virtual memory (VM) overcome physical memory limitations?
vm –> makes every program think its the only one running in main memory at that time (not true),
- mmu and os beat memory
fragmentation by making sure
everything gets mapped to
correct section in DRAM
- vm lets multiple programs run at
same time by running them in
virtual memory and mapping
them to certain addresses in
physical memory
role of VM during the assemble and linking steps
os –> defines “common” virtual address space that are used by linker and loader
“common” virtual address space –> can be applied for all programs (same heap memory segment will have same virtual address locations)
MMU translates these addresses to physical address in DRAM
total number of virtual addresses =
2^n
n = virtual address bits
total number of PTEs =
2^(n-p)
n = virtual address bits
p = vpo bits
size of one page (in bytes) =
2^p
p = vpo bits
total number of physical addresses =
2^m
m = physical address bits
total number of physical memory frames =
2^m / 2^p = 2^(m-p)
m = physical address bits
p = pfo bits
(m-p) = pfn bits
size of one frame (in bytes) =
2^p
p = pfo bits
are frame size and page size the same size?
yes, # of VPO bits = # of PFO bits
virtual page
virtual memory = array that holds fixed-sized blocks –> virtual pages
virtual pages –> binary files that reside on the ssd
size of vp =
2^p
p = # of page offset bits