Physical Memory Management
Physical Memory
- byte addressable (can refer to each byte in memory), limited size
- ~200 cycles access latency (as a reference, common instrs within 7 cycles)
- a process's code and data needs to be in memory to execute
Physical Memory Management
- a resource allocation problem: how to multiplex processes onto the physical memory
- attempt 1: give each process the entire physical memory while it's running
- no translation needed, process's virtual address = physical address
- what would a context switch involve?
- where can we store the process's memory when it's not running?
- how can we enforce kernel/user separation?
- how would this work when there are multiple cores?
- attempt 2: place processes' memory in disjoint sections of physical memory
- each process no longer has the entire physical memory, only a section that fits its virtual address space
- should processes be aware of their placement in physical memory?
- require memory translation!
- hw support: base and bound registers
- is this an efficient and effective way of using physical memory?
- processes may share the same library code, does this approach support sharing a part of memory?
- processes may grow to use more memory as they run, does this approach support memory growth?
- processes may use different amount of memory, does this approach handle variable-sized allocation well?
- attempt 3: fine grained memory mapping and permission
- goals: good memory utilization, more sharing of physical memory, flexible growth
- to support flexible growth
- no longer requires contiguous virtual memory to be mapped contiguous in physical memory
- to support better memory utilization
- divide physical memory into fixed sized chunks (physical page) and only do fixed-sized allocation
- demand paging: only load in the actively accessed portion of virtual memory into the physical memory
- to support sharing
- fine grained mapping permission allows multiple proceses to share common library code
- how would memory translation work for this approach?