Consider the page references 7,0,1,2,0,3,0,4,2,3,0,3,2, Find the number of page fault using OPR and  FIFO, with 4 page frame.

  • Answered by Nemi
  • 0 Comments
  • 12 months ago

To calculate the page faults using OPR and FIFO page replacement algorithms, we first need to understand how these algorithms work.

FIFO (First-In-First-Out) algorithm replaces the page that has been in the memory for the longest time. It’s a simple algorithm that keeps track of the order in which pages were loaded into the memory and replaces the oldest page first.

OPR (Optimal Page Replacement) algorithm replaces the page that will not be used for the longest period of time. It’s an optimal algorithm that has the advantage of knowing the future behavior of the program and replacing the page that will not be needed for the longest time.

Let’s consider the given page references and find the number of page faults using FIFO and OPR algorithms, with a 4-page frame:

FIFO Algorithm:

7 0 1 2 0 3 0 4 2 3
7 7 7 7 7 0 0 1 1 1
0 0 0 0 1 1 2 2 2
1 1 1 2 2 3 3 3
2 2 3 3 4 4 4
F F F F F F
0 3 2
1 1 1
2 2 2
3 3 3
4 4 4
F

Total number of page faults using FIFO algorithm = 7

OPR Algorithm:

7 0 1 2 0 3 0 4 2 3
7 7 7 7 7 3 3 3 3 3
0 0 0 0 0 0 4 4 4
1 1 1 1 1 1 1 1
2 2 2 2 2 2 2
F F F F F F
0 3 2
3 3 3
4 4 4
1 1 2
0 0 0
F F

Total page faults using OPR algorithm: 8.

Therefore, the number of page faults using FIFO algorithm is 7, and the number of page faults using OPR algorithm is 8.

If you found any type of error on the answer then please mention on the comment or report an answer or submit your new answer.
Leave your Answer:

Click here to submit your answer.

s
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments