ITPEC FE Morning April 2020 Question 18

Topic: Software

Assume that there are three pages in the real memory that can be allocated by the LRU method. Which of the following is the number of page faults for the page reference string shown below? Here, three pages are initially empty, and filling of an empty page is not considered as a page replacement operation. The numbers are the page IDs that come to the system from left to right.

Page reference string2411273465512

Explanation

7 — trace LRU with three frames and count the references that force a page out.

Pages are listed from least to most recently used; filling an empty frame is not counted.

ReferenceResultPages afterReplaced
2, 4, 1fill2, 4, 1none
1hit2, 4, 1none
2hit4, 1, 2none
7fault1, 2, 74
3fault2, 7, 31
4fault7, 3, 42
6fault3, 4, 67
5fault4, 6, 53
5hit4, 6, 5none
1fault6, 5, 14
2fault5, 1, 26

Seven references replace a page.

Answer (d)

Why not others:

  • •(a) 4, (b) 5 and (c) 6 — each misses some replacements: after the two early hits, every reference except the repeated 5 needs a page that is not in memory; the late 4, 1 and 2 were each pushed out by three newer pages

Key rule: Under LRU with k frames, a reference hits only if fewer than k other distinct pages have been referenced since that page was last used.

Software · AI-written, may contain errors

This question comes from an official ITPEC past paper. ITPEC Practice is an independent study tool and is not affiliated with ITPEC. See the official FE past-paper collection or Report an issue.