Description:
- Multiple programs share the same physical RAM so they must be requirements to protect eachother:
- Transparency: a program should not know other programs are sharing the same MM and contents of other programs
- Protection: a program must not be able to corrupt other programs
- So each program is provided a virtual address space, allocated and managed by the operating system dynamically
- Programs’ addresses are virtual when compiled
- Program’s virtual addresses are used in its code are start from 0, but actually offset to a section of the RAM
Frame allocation:
- Each process needs a minimum number of frames
- Fixed allocation vs priority allocation:
- fixed:
- equal allocation: keep some as free frame buffer pool
- proportionally allocation: allocate according to the size of the process
- dynamic as degree of multiprogramming, process size changes
- priority allocation:
- based on the process priority, prioritize foreground
Global Allocation | Local Allocation |
---|
process selects a replacement frame from the set of all frames; one process can take a frame from another | each process selects from only its own set of allocated frames |
greater thruput | consistent per-process performace |
process execution time can vary greatly | possibily underutilized memory |
Thrashing:
- A process is busy swapping pages in and out
- it doesnt have enough pages, the page-fault rate is high
- → low cpu utilization → OS thinks that it needs to increase the degree of multiprogramming to have more CPU usage
- Solution:
- page replacement algorithm:
- local replacement
- priority replacement
- working-set model:
- approximate the locality
- Once thrashing happens, suspend or swap out one of the process