Chapter 8 Flashcards
(9 cards)
Virtual mem - demand paging
Illusion of a larger main mem, achieved by swapping out unused mem areas from RAM to secondary storage. The system provides necessary mem areas on demand which is known by demand paging. This means mem pages are loaded into RAM only when they are actually needed, rather than loading the entire process.
For demand paging to be efficient, the rate of page faults should be very low
Copy on Write COW
Allows the system to postpone copying pages of mem during process generation until one of the processes tries to modify the page. Thus the system makes a copy only when its actually needed.
Replacement strategy - FIFO
Replaces the oldest page in mem.
the more page frames there are, the more swap in ops there are.
Replacement strategy - Optimal Replacement Strategy OPT
Is based on the concept of the longest forward distance LFD, it is the time interval until the next access to this page. It predicts which page wont be needed for the longest time in the future.
The more page frames there are, the less swap in ops there will be.
Replacement strategy - Least recently used LRU
Increasing the number of page frames wont lead to more page faults which is known as FIFO anomaly.
Replacement strategy - Second Chance SC
Use reference bits to track whether a page has been recently accessed. When a page is swapped in mem, its reference bit is initially set to 1.
When the system needs to find a victim page to swap out, it inspects the reference bits in the page table one by one: if the reference bit is 1, then the page has been accessed recently so the bit is reset to 0 and the page is given a second chance in the main memory.
if the reference is zero, this indicates that the page hasn’t been accessed recently and is chosen to be swapped out.
If all reference bits are 1, SC degrades to FIFO. However, SC is close to LRU.
The more page frames there are, the more swap in ops we’ll have
SC may lead to FIFO anomaly.
Enhanced SC: we have an additional dirty bit when set to 0 means not modified, when set to 1 means modified so we will have 4 classes (0,0) … (1,1) and we search for the lowest class to be swapped out
Page frame allocation
How many swapped in pages should a process have?
- max: is limited by the size of the available mem, meaning how many page frames can the system have
- min: depends on the CPU architecture
- in homogenous allocation, the number of processes determine how many page frames each process can have, it evenly divides available page frames among all processes.
- in size-based allocation, larger processes receive more page frames, while smaller processes receive fewer.
- In local allocation, each process is responsible for managing and replacing its own pages. When a page fault occurs, the process can only replace one of its own pages and cannot use or replace pages belonging into other processes.
- In Global allocation, processes can replace pages not only from their own set of allocated page frames but also from the page frames allocated to other processes.
Thrashing - seitenflattern
Occurs when a system spends more time handling page faults than execurting actual processes.
Causes: too many processes, insufficient page frames or bad replacement strategy
Solutions: local page allocation, sufficient page frames
- Solution: swap out inactive processes
- Solution: working set model: this model attempts to approximate the number of pages a process truly needs to execute efficiently. The working set is the set of pages that a process has recently referenced and is likely to need shortly. The idea is to keep these pages in mem while swapping out all the other pages.
- Solution: react on rate of page faults: if pages fault rate < threshold then decrease number of page frames, otherwise increase