Computer Science Engineering (CSE) Exam  >  Computer Science Engineering (CSE) Questions  >  Consider the virtual page reference string 1,... Start Learning for Free
Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Then
  • a)
    OPTIMAL < LRU < FIFO
  • b)
    OPTIMAL < FIFO < LRU
  • c)
    OPTIMAL = LRU
  • d)
    OPTIMAL = FIFO
Correct answer is option 'B'. Can you explain this answer?
Verified Answer
Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, ...
First In First Out (FIFO) This is the simplest page replacement algorithm. In this algorithm, operating system keeps track of all pages in the memory in a queue; oldest page is in the front of the queue. When a page needs to be replaced page in the front of the queue is selected for removal. Optimal Page replacement: in this algorithm, pages are replaced which are not used for the longest duration of time in the future. Least Recently Used (LRU) In this algorithm page will be replaced which is least recently used. Solution: the virtual page reference string is 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 size of main memory pages frames is 3. For FIFO: total no of page faults are 6 (depicted in bold and italic) 
For optimal: total no of page faults are 5 (depicted in bold and italic) 
For LRU: total no of page faults are 9 (depicted in bold and italic) 
The Optimal will be 5, FIFO 6 and LRU 9. so, OPTIMAL < FIFO < LRU option (B) is correct answer.
View all questions of this test
Most Upvoted Answer
Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, ...
Page Replacement Algorithms
Page replacement algorithms are used in demand paging to decide which page to replace when a new page needs to be brought into memory. There are several page replacement algorithms, including LRU, FIFO, and OPTIMAL.

Given Scenario
In this scenario, we have a virtual page reference string of 1, 2, 3, 2, 4, 1, 3, 2, 4, 1. The main memory size is 3 page frames, initially empty. We need to determine the number of page faults under each of the page replacement policies.

LRU Algorithm
The LRU (Least Recently Used) algorithm replaces the page that has not been used for the longest time. The number of page faults under LRU for the given reference string is as follows:

- 1: Page fault, page 1 is loaded into memory.
- 2: Page fault, page 2 is loaded into memory.
- 3: Page fault, page 3 is loaded into memory.
- 2: No page fault, page 2 is already in memory.
- 4: Page fault, page 4 is loaded into memory.
- 1: Page fault, page 1 is replaced with page 4.
- 3: Page fault, page 3 is replaced with page 1.
- 2: Page fault, page 2 is replaced with page 3.
- 4: Page fault, page 4 is replaced with page 2.
- 1: Page fault, page 1 is replaced with page 4.

Total number of page faults under LRU: 6

FIFO Algorithm
The FIFO (First-In, First-Out) algorithm replaces the page that has been in memory the longest. The number of page faults under FIFO for the given reference string is as follows:

- 1: Page fault, page 1 is loaded into memory.
- 2: Page fault, page 2 is loaded into memory.
- 3: Page fault, page 3 is loaded into memory.
- 2: No page fault, page 2 is already in memory.
- 4: Page fault, page 4 is loaded into memory.
- 1: Page fault, page 1 is replaced with page 2.
- 3: Page fault, page 3 is replaced with page 3.
- 2: Page fault, page 2 is replaced with page 4.
- 4: Page fault, page 4 is replaced with page 1.
- 1: Page fault, page 1 is replaced with page 2.

Total number of page faults under FIFO: 7

OPTIMAL Algorithm
The OPTIMAL algorithm replaces the page that will not be used for the longest time. It is the optimal algorithm in terms of minimizing the number of page faults, but it is not always practical to implement. The number of page faults under OPTIMAL for the given reference string is as follows:

- 1: Page fault, page 1 is loaded into memory.
- 2: Page fault, page 2 is loaded into memory.
- 3: Page fault, page 3 is loaded into memory.
- 2: No page fault, page 2 is already in memory.
- 4: Page fault, page
Explore Courses for Computer Science Engineering (CSE) exam

Similar Computer Science Engineering (CSE) Doubts

Top Courses for Computer Science Engineering (CSE)

Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. Can you explain this answer?
Question Description
Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. 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 Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. 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 Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. Can you explain this answer?.
Solutions for Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. 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 Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. Can you explain this answer? defined & explained in the simplest way possible. Besides giving the explanation of Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. Can you explain this answer?, a detailed solution for Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. Can you explain this answer? has been provided alongside types of Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. Can you explain this answer? theory, EduRev gives you an ample number of questions to practice Consider the virtual page reference string 1, 2, 3, 2, 4, 1, 3, 2, 4, 1 On a demand paged virtual memory system running on a computer system that main memory size of 3 pages frames which are initially empty. Let LRU, FIFO and OPTIMAL denote the number of page faults under the corresponding page replacements policy. Thena)OPTIMAL < LRU < FIFOb)OPTIMAL < FIFO < LRUc)OPTIMAL = LRUd)OPTIMAL = FIFOCorrect answer is option 'B'. 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