Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
149 views
in Computer by (85.4k points)
closed by
Consider a computer system with ten physical page frames. The system is provided with an access sequence (a1, a2,…,a20, a1, a2,…,a20), where each ai is a distinct virtual page number. The difference in the number of page faults between the last-in-first-out page replacement policy and the optimal page replacement policy is ______.

1 Answer

0 votes
by (88.5k points)
selected by
 
Best answer

Concept:

Last-in-first-out page replacement policy: It replaces the newest page that arrives at last in the main memory.

Optimal Page replacement policy: It replaces the page whose next use will occur farthest in the future.

Explanation:

Access sequence is (a1, a2,…,a20, a1, a2,…,a20)

a1 to a10 will result in page faults. Total 10 page faults in this.

Then a11 comes, it replaces a10, a12 replaces a11, a13 replaces a12 and so on,….10 page faults from a11 to a20.

Now when a1 to a9 occurs again, it will result in 0 page fault because these are already present in the page frame. Again a10 will replace a20, a11 replaces a10 and so on. So, in this way total 11 page faults from a10 to a20­.

Total page faults = 10 + 10 + 11 = 31

Using optimal page replacement:

a1 to a10 will result in page faults. Total 10 page faults in this.

Then a11 will replace a10 because from a1 to a10, a10 will be used later, a12 replaces a11 and so on. 10 page faults from a11 to a20.

Again a1 to a9, 0 page faults. a10 will replace a1, a10 to a19 will have 10 page faults.

Total page faults in this = 10 + 10 + 10 = 30

So, difference in number of page faults = 31 – 30 = 1

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...