Professional Documents
Culture Documents
Advanced Computer Architecture - : Virtual Memory
Advanced Computer Architecture - : Virtual Memory
Virtual address is generated by the CPU; Here the CPU assumes the entire memory space to be
available as allowed by the number of addresses- 2 (no. of address lines)
Physical address is the address actually seen by the physical memory
Virtual and physical addresses are the same in compile-time and load-time address-binding
schemes; virtual and physical addresses differ in execution-time address-binding schemes
Advantages of Virtual Memory
Translation:
o Program can be given consistent view of memory, even though physical memory
is scrambled
o Only the most important part of program (Working Set) must be in physical
memory.
o Contiguous structures (like stacks) use only as much physical memory as
necessary yet grow later.
Advantages of Virtual Memory
o Protection:
o Different threads (or processes) protected from each other.
o Different pages can be given special behavior
o (Read Only, Invisible to user programs, etc).
o Kernel data protected from User programs
Very important for protection from malicious programs
Sharing:of VM is possible as we can map same physical page to multiple users (Shared
memory)
Virtual vs. Physical Address Space:
Use of Paging in Virtual Memory:
Divide physical memory into fixed-size blocks (e.g., 4KB) called frames
Divide logical memory into blocks of same size (4KB) called pages
To run a program of size n pages, need to find n free frames and load program
Set up a page table to map page addresses to frame addresses (operating system sets up
the page table)
Cache and Virtual
Memory
Replacement:
Cache Miss by HW
Page fault by OS
offset <13>
<8> <4><1>
ASN Pr V
<35>
Tag
<31>
PPN
...
...
128:1 mux
44-bit physical address