Consider a hypothetical machine with 3 pages of physical memory, 5 pages of virtual memory, and as the stream of page references by an application. If P and Q are the number of page faults the application would incur with the FIFO and LRU page-replacement algorithms respectively (assuming enough space for storing 3 page frames), then (P, Q) = ____.
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: D. (11,12)
Explanation
FIFO (evict the oldest-loaded page, queue order): A,B,C fault to fill the 3 frames; D faults, evicting A; A faults again, evicting B; B faults, evicting C; E faults, evicting D (frames now A,B,E) — the next A and B are hits; C faults evicting A; D faults evicting B; E is now a hit (frames E,C,D); B faults evicting E; A faults evicting C; the final B is a hit — giving 11 faults (P=11). LRU (evict the least-recently-used page): the first 7 references (A,B,C,D,A,B,E) fault identically to FIFO; the two hits on A and B refresh their recency; then C faults evicting the now-LRU E; D faults evicting A; E faults evicting B; B faults evicting C; A faults evicting D; the final B is a hit — giving 12 faults (Q=12). Hence (P,Q) = (11,12), option (iv).More Programming Languages and Computer Graphics questions
- For the page reference string 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1 with 3 page frames (initially empty), which page r…
- Which of the following is incorrect for virtual memory?
- A memory management system has 64 pages with a page size of 512 bytes. Physical memory consists of 32 page frames. The number of bits requi…
- Consider the page-reference string: 0 1 2 3 0 1 4 0 1 2 3 4. If the FIFO page-replacement algorithm is used, find the number of page faults…
- What would be the equivalent pointer expression for referring the array element ar[ m ][ n ][0]
- Which of the following technique is used for Clipping?