875 views

A system uses $3$ page frames for storing process pages in main memory. It uses the Least Recently Used (LRU) page replacement policy. Assume that all the page frames are initially empty. What is the total number of page faults that will occur while processing the page reference string given below?

$\text{4, 7, 6, 1, 7, 6, 1, 2, 7, 2}$

edited | 875 views

Total page faults $=6.$

$\small\begin{array}{|c|c|c|c|} \hline \quad\bf{4}\quad& \quad\bf{7} \quad& \quad \bf{6}\quad & \quad\bf{1}\quad&\quad\bf{7}\quad&\quad \bf{6}\quad &\quad \bf{1}\quad &\quad \bf{2}\quad &\quad \bf{7}\quad &\quad \bf{2}\quad \\ \hline & & \underset{\boxed{F}}6&6&6&6&6&6&\underset{\boxed{F}}7&7\\ \hline \hline &\underset{\boxed{F}}7 &7 &7&7&7&7&\underset{\boxed{F}}2&2&2\\ \hline \hline \underset{\boxed{F}}{4}&4 & 4&\underset{\boxed{F}}1&1&1&1&1&1&1\\ \hline \end{array} \implies 6\text{ faults}$

Another way of answering the same.

$\require{cancel} \begin{array}{|c|}\hline \quad6\quad \\\hline 7\\\hline\quad\cancel {4} \quad 1\\ \hline \end{array}$ $\require{cancel} \begin{array}{|c|}\hline \quad6\quad \\\hline \cancel{7}{2}\\\hline 1\\ \hline \end{array}$ $\require{cancel} \begin{array}{|c|}\hline \quad\cancel {6}{7}\quad \\\hline{2}\\\hline1\\ \hline \end{array}$$\require{cancel} \begin{array}{|c|}\hline \quad7\quad \\\hline {2}\\\hline 1\\ \hline \end{array}$ $\implies 3 \text{ faults}+3 \text{ initial access faults} = 6 \text{ page faults}$

OR

$\require{cancel} \begin{array}{|c|}\hline \quad\cancel6 7\quad \\\hline\cancel {7}2\\\hline\cancel 4 1\\ \hline \end{array} \implies 3 \text{ faults}+3 \text{ initial access faults} = 6 \text{ page faults}$

answered by Boss (22.4k points)
edited by
total : 6
answered by Active (1.3k points)

answer will be 6 page fault

answered by Boss (20.6k points)
0
Image is wrong . Answer is 6
0
as i have missed the hit by myself  as i have use shortcut while answering .... :)

1
2