View worked solution
Answer: 1
We are given physical page frames and an access sequence of length :
1. Last-In-First-Out (LIFO) Policy:
- First 10 accesses ( to ): page faults. Frames contain .
- Next 10 accesses ( to ): page faults. Each new page replaces the most recently loaded page in the frame. After , the frames contain .
- Second half ( to ):
- to are hits ( faults).
- causes a page fault and replaces .
- to each cause a page fault, sequentially replacing the page in the frame ( faults total for ).
Total LIFO page faults = .
2. Optimal Page Replacement Policy:
- First 10 accesses ( to ): page faults. Frames contain .
- Next 10 accesses ( to ): page faults. To minimize future faults, we replace the page whose next reference is furthest in the future:
- replaces (since is needed at step , while are needed earlier).
- replaces , and so on, up to replacing .
- Frames after the first half: .
- Second half ( to ):
- to are hits ( faults).
- to cause page faults. We can replace any of the pages as they are not needed anymore, keeping in memory.
- is a hit ( faults).
Total Optimal page faults = .
The difference in the number of page faults is .
Free practice · Your answers on this page are not saved.
