Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  A computer has twenty physical page frames wh... Start Learning for Free
A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?
  • a)
    Least-recently-used
  • b)
    First-in-first-out
  • c)
    Last-in-first-out
  • d)
    Most-recently-used
Correct answer is option 'D'. Can you explain this answer?
Verified Answer
A computer has twenty physical page frames which contain pages numbere...
The optimal page replacement algorithm swaps out the page whose next use will occur farthest in the future. In the given question, the computer has 20 page frames and initially page frames are filled with pages numbered from 101 to 120. Then program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. The first 20 accesses to pages from 1 to 20 would definitely cause page fault. When 21st is accessed, there is another page fault. The page swapped out would be 20 because 20 is going to be accessed farthest in future. When 22nd is accessed, 21st is going to go out as it is going to be the farthest in future. The above optimal page replacement algorithm actually works as most recently used in this case. Iteration 1: (1-100) Not present - all replaced 1-20 in 20 frames, 21-100 in 20th frame. hence, page faults = 100 Iteration 2: (1-19) present | (20-99) NOT present | (100) present - the replacements are done at the 19th frame hence, page faults = 100 - 19 - 1 = 80 Iteration 3: (1-18) present | (19-98) NOT present | (99-100) present - the replacements are done at the 18th frame hence page faults = 100 - 18 - 2 = 80 Iteration 4: (1-17) present | (17-97) NOT present | (98-100) present - the replacements are done at the 17th frame hence page faults = 100 - 17 - 3 = 80 Total page faults = 100 + 80 + 80 +80 = 340 Along with generating same number of page faults M.R.U also generates replacements at the same positions as in the Optimal algorithm.(Assuming the given 101-120 pages are INVALID (not belonging to the same process) or Empty). While the LIFO replacement does not behave like Optimal replacement algorithm as it generates 343 page faults. Because from 21st page all pages are placed in 20th frame, therefore hits per iteration reduces down to 19 from the 2nd iteration of pages. Whereby Total Page faults = 100 + 81 + 81 + 81 = 343
View all questions of this test
Most Upvoted Answer
A computer has twenty physical page frames which contain pages numbere...
3, ..., 20 in sequence. Assume that none of these pages are currently in memory prior to the program's execution.

Initially, all page frames are empty. When the program first accesses page 1, it is loaded into an empty page frame (let's say frame 0). When the program then accesses page 2, it is also loaded into an empty page frame (let's say frame 1). The same goes for page 3, which is loaded into frame 2.

Now the program tries to access page 4, but there are no more empty page frames available. Therefore, the operating system must choose a page to evict from memory to make room for page 4. One common algorithm for page replacement is called the Least Recently Used (LRU) algorithm.

Using the LRU algorithm, the operating system would choose to evict the page that was least recently used. In this case, that would be page 1, which was accessed first and has not been used since it was loaded into frame 0. Therefore, page 1 would be evicted from frame 0 and replaced with page 4.

The program continues in this way, accessing pages 5 through 20. Each time it tries to access a new page and all page frames are full, the LRU algorithm will be used to evict the least recently used page and replace it with the new page.

Overall, the program would result in 20 page faults (one for each page accessed) and 3 page replacements (when pages 1, 4, and 7 are evicted from memory).
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer?
Question Description
A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? for Computer Science Engineering (CSE) 2024 is part of Computer Science Engineering (CSE) preparation. The Question and answers have been prepared according to the Computer Science Engineering (CSE) exam syllabus. Information about A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? covers all topics & solutions for Computer Science Engineering (CSE) 2024 Exam. Find important definitions, questions, meanings, examples, exercises and tests below for A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer?.
Solutions for A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? in English & in Hindi are available as part of our courses for Computer Science Engineering (CSE). Download more important topics, notes, lectures and mock test series for Computer Science Engineering (CSE) Exam by signing up for free.
Here you can find the meaning of A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer?, a detailed solution for A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? has been provided alongside types of A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice A computer has twenty physical page frames which contain pages numbered 101 through 120. Now a program accesses the pages numbered 1, 2, …, 100 in that order, and repeats the access sequence THRICE. Which one of the following page replacement policies experiences the same number of page faults as the optimal page replacement policy for this program?a)Least-recently-usedb)First-in-first-outc)Last-in-first-outd)Most-recently-usedCorrect answer is option 'D'. Can you explain this answer? tests, examples and also practice Computer Science Engineering (CSE) tests.
Explore Courses for Computer Science Engineering (CSE) exam

Top Courses for Computer Science Engineering (CSE)

Explore Courses
Signup for Free!
Signup to see your scores go up within 7 days! Learn & Practice with 1000+ FREE Notes, Videos & Tests.
10M+ students study on EduRev