Consider the data given in above question. Least Recently Used (LRU) p...
LRU replacement policy: The page that is least recently used is being Replaced. Given String: 1, 2, 1, 3, 7, 4, 5, 6, 3, 1 123 // 1 ,2, 3 //page faults 173 ->7 473 ->4 453 ->5 456 ->6 356 ->3 316 ->1 Total 9, In optimal Replacement total page faults=7 Therefore 2 more page faults Answer is C
View all questions of this test
Consider the data given in above question. Least Recently Used (LRU) p...
To determine the number of additional page faults that occur with the Least Recently Used (LRU) page replacement policy compared to the optimal page replacement policy, we need to analyze the given reference string and simulate both policies.
Given reference string: 1 2 3 4 2 1 5 6 2 1 2 3 7 6 3 2 1 2 3 6
Optimal page replacement policy:
The optimal page replacement policy replaces the page that will not be used for the longest period of time in the future. Since we don't have future information in this question, we can only make assumptions based on the given reference string.
LRU page replacement policy:
The LRU page replacement policy replaces the page that has not been used for the longest period of time. It maintains a queue of the most recently used pages and replaces the page at the front of the queue.
To simulate both policies, we will use a frame size of 3 (as mentioned in the previous question).
Simulation:
1. Optimal page replacement policy:
- Initially, the frames are empty. So, page fault occurs for 1.
- Page 2 is referenced next. So, page fault occurs for 2.
- Page 3 is referenced next. So, page fault occurs for 3.
- Page 4 is referenced next. So, page fault occurs for 4.
- Page 2 is referenced again. No page fault occurs.
- Page 1 is referenced next. So, page fault occurs for 1.
- Page 5 is referenced next. So, page fault occurs for 5.
- Page 6 is referenced next. So, page fault occurs for 6.
- Page 2 is referenced again. No page fault occurs.
- Page 1 is referenced again. No page fault occurs.
- Page 2 is referenced again. No page fault occurs.
- Page 3 is referenced next. So, page fault occurs for 3.
- Page 7 is referenced next. So, page fault occurs for 7.
- Page 6 is referenced again. No page fault occurs.
- Page 3 is referenced again. No page fault occurs.
- Page 2 is referenced again. No page fault occurs.
- Page 1 is referenced again. No page fault occurs.
- Page 2 is referenced again. No page fault occurs.
- Page 3 is referenced again. No page fault occurs.
- Page 6 is referenced again. No page fault occurs.
Total page faults with optimal page replacement policy = 9
2. LRU page replacement policy:
- Initially, the frames are empty. So, page fault occurs for 1.
- Page 2 is referenced next. So, page fault occurs for 2.
- Page 3 is referenced next. So, page fault occurs for 3.
- Page 4 is referenced next. So, page fault occurs for 4.
- Page 2 is referenced again. No page fault occurs.
- Page 1 is referenced next. So, page fault occurs for 1.
- Page 5 is referenced next. So, page fault occurs for 5.
- Page 6 is referenced next. So, page fault occurs for 6.
- Page
To make sure you are not studying endlessly, EduRev has designed Computer Science Engineering (CSE) study material, with Structured Courses, Videos, & Test Series. Plus get personalized analysis, doubt solving and improvement plans to achieve a great score in Computer Science Engineering (CSE).