Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors

Consider the following page reference string:1,2,3,4,5,3,4,1,2,7,8,7,8,9,7,8,9,5,4,5. How many page faults would occur for the following replacement algorithm, assuming four frames:a) FIFOb) LRU

Consider the following page reference string:
1,2,3,4,5,3,4,1,2,7,8,7,8,9,7,8,9,5,4,5. How many page faults would occur for the following replacement algorithm, assuming four frames:
a) FIFO
b) LRU

a) FIFO (First In First Out) algorithm:

Using the FIFO algorithm with four frames and the given page reference string, the page faults occur as follows:

PageFrame 0Frame 1Frame 2Frame 3Page Fault?
11Yes
212Yes
3123Yes
41234Yes
55234Yes
35234No
45234No
15234No
25234No
75734Yes
85784Yes
75784No
85784No
95789Yes
75789No
85789No
95789No
55789No
45489Yes
55489No

Therefore, the total number of page faults is 9.


b) LRU (Least Recently Used) algorithm:

Using the LRU algorithm with four frames and the given page reference string, the page faults occur as follows:

PageFrame 0Frame 1Frame 2Frame 3Page Fault?
11Yes
212Yes
3123Yes
41234Yes
55234Yes
35234No
45234No
11234Yes
21234No
71274Yes
81278Yes
71278No
81278No
91279Yes
71279No
81289Yes
91289No
51259Yes
41254Yes
51254No

Therefore, the total number of page faults is 10.