Virtual Memory
- We have talked about virtualizing the CPU.
- Now we need to virtualize memory: We want each process
to be able to believe that it is the only process using RAM.
- Key questions
- How to minimize overhead (i.e., maximize efficiency)
- Provide protection
Address Space
- Early on, only one process loaded on machine.
- Process had the entire address space
- OS was effectively just a library.
- Soon wanted time sharing
- Run customer B’s process while customer A’s process blocked on I/O.
- Not practical (or necessary) to “save” entire address space.
- Stepped up even more when we wanted interactivity
- Also need protection at this point.
- (Imagine two competitors paying for time on the same mainframe)
- Having two programs in memory at once requires careful thought.
- Protection, and
- How to manage addresses in code
- When you compile a program, ideally, we’d like instructions like
j, beq
lw and sw to use actual addresses (i.e., avoid extra “work”)
- But, process shouldn’t have to be explicitly aware of where it is loaded.
- Besides, how would you change the addresses depending on where process
was placed in memory?
- We need a system where the addresses a program “sees” can be different from the
addresses the hardware “sees”.
- Key features of a solution:
- Transparency (unaware)
- Efficiency
- For example emulation is transparent, but not efficient
- Protection