Question
#1. A process has a memory reference pattern as follows: 1 3 1 2 3 4 2 3 1 2 3 4 The above pattern
#1. A process has a memory reference pattern as follows: 1 3 1 2 3 4 2 3 1 2 3 4
The above pattern (which represents the virtual page numbers of the process) repeats
throughout the execution of the process. Assume that there are 3 physical frames.
Show the paging activity for a True LRU page replacement policy. Show an LRU
stack and the page that is replaced (if any) for the first 12 accesses. Clearly indicate
which accesses are hits and which are page faults.
Solution:
| 1 | 3 | 1 | 2 | 3 | 4 | 2 | 3 | 1 | 2 | 3 | 4 |
F1 |
|
|
|
|
|
|
|
|
|
|
|
|
F2 |
|
|
|
|
|
|
|
|
|
|
|
|
F3 |
|
|
|
|
|
|
|
|
|
|
|
|
LRU |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
H/PF |
|
|
|
|
|
|
|
|
|
|
|
|
H: hit PF: Page fault
#2. A process has a memory reference pattern as follows: 4 3 1 2 3 4 1 4 1 2 3 4
The above pattern (which represents the virtual page numbers of the process) repeats
throughout the execution of the process.
What would be the paging activity for an optimal page replacement policy for the first
12 accesses? Indicate which accesses are hits and which are page faults.
Solution:
| 4 | 3 | 1 | 2 | 3 | 4 | 1 | 4 | 1 | 2 | 3 | 4 |
F1 |
|
|
|
|
|
|
|
|
|
|
|
|
F2 |
|
|
|
|
|
|
|
|
|
|
|
|
F3 |
|
|
|
|
|
|
|
|
|
|
|
|
H/PF |
|
|
|
|
|
|
|
|
|
|
|
|
Assume there are only three available physical frames. And H = hit, PF = Page Fault.
Thanks for the help
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started