chapter 15 - Mechanism: Address Translation Flashcards
key goal of memory virtualization
Let programs believe they have private memory starting at address 0, even though OS places them anywhere in physical memory
What enables efficient memory virtualization?
Hardware-based address translation
assumptions for simple address translation
- Address space must be contiguous in physical memory
- Address space is smaller than physical memory
- Address spaces are the same size
What does the OS do instead of placing programs at 0? - if full
Relocates processes elsewhere in physical memory and uses address translation
What are the two main hardware components for dynamic relocation?
Base register: Starting address of the process in physical memory
Bounds register: Size limit of the process’s memory
What is the formula for translating addresses?
Physical address = Virtual address + Base
What happens if a virtual address exceeds the bounds?
he CPU raises an exception; typically, the process is terminated
What is the Memory Management Unit (MMU)
A hardware part of the CPU that performs address translation automatically
Where are base and bounds stored?
Inside the CPU, managed by the MMU
What hardware features are needed for memory virtualization?
CPU modes (kernel/user)
Base and bounds registers
Privileged instructions (only kernel can change base/bounds)
Exception handling (for illegal memory access)
What must the OS do during process creation?
Search the free list
Allocate memory
Set base and bounds registers
What happens when a process terminates?
Free its memory
Return it to the free list
Clean up PCB (process control block) data
What happens during a context switch regarding memory virtualization?
Save base and bounds into the process’s PCB
Load the next process’s base and bounds into CPU registers
How can the OS move a process’s address space?
Deschedule the process
Copy the memory to a new location
Update the saved base register
What happens when an exception is raised during memory access?
The OS typically terminates the process to protect system integrity.