Computer PPSC
For 3 page frames, the following is the reference string: 701 20 3 0 4 2 3 0 3 2 1 20 1 7 0 1; How many page faults does the LRU page replacement algorithm produce?
Explanation
Faults occur at references 7, 0, 1, 2, 3, 4, 2, 3, 0, 1, 0 and 7 (at the 1st, 2nd, 3rd, 4th, 6th, 8th, 9th, 10th, 11th, 14th, 16th and 18th positions), while the remaining 8 references are hits. This is the standard textbook result for this reference string with 3 frames.
Related facts:
For the same reference string and 3 frames, FIFO produces 15 faults and the optimal algorithm produces 9.
A page fault occurs when the referenced page is not resident in any frame.
TABLEAlgorithmPage faults (3 frames)Optimal9LRU12FIFO15
Exam tip: Practice this classic reference string by hand; examiners frequently ask the fault counts for FIFO, LRU and optimal on it.