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

May 3, 2023 · Team EasyExamNotes · 1 min read (est.) · 0 comments

Share on WhatsApp

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.

Discussion

Ask a question, share your thoughts or report an error.

Sign in to participate in the discussion.

Join the discussion