Question
In the Least Recently Used (LRU) page replacement
algorithm, given the following reference string 4, 2, 4, 1, 5, 2, 3, 4, and assuming 3 frames, how many page faults will occur?Solution
LRU page replacement works by replacing the page that has not been used for the longest time. For the reference string 4, 2, 4, 1, 5, 2, 3, 4 with 3 frames, the page faults occur as follows: • Insert 4 (fault), Insert 2 (fault), Access 4 (hit), Insert 1 (fault), Insert 5 (fault, replace 4), Access 2 (hit), Insert 3 (fault, replace 1), Access 4 (fault, replace 5). Thus, there are 6 page faults in total. LRU minimizes page faults compared to other algorithms by always keeping the most recently used pages in memory. Why other options are wrong: A) 3 faults would require the reference string to contain repeated pages with no replacements. B) 5 faults underestimate the replacements required after the first few frames fill up. D) 7 faults occur in algorithms with more aggressive replacements like FIFO. E) 8 faults assume no page hits at all, which is incorrect since some pages are reused before replacement.
12Â Â Â Â Â Â Â Â Â Â Â Â Â 10Â Â Â Â Â Â Â Â Â Â Â Â 13Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 18.5Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 25.50Â Â Â Â Â Â Â ...
7, 14, 42, 210, 1470, ?
6, 17, 21, 47, ?, 107
21     84      168      172     ?     348
...315 146 267 ? 235 210
14 20 35 ? 433 2167
...18, 32, 50, 82, 132, ?
840 400 180 ? 15 -12.5
...22Â Â Â 23Â Â Â Â 32Â Â Â Â 57Â Â Â 106Â Â Â ?
Three series are given below. You have to find the values of P, Q and R, then establish a relationship among them.
I:Â Â Â 210, P , 233, 64,...