edited by
8,244 views
18 votes
18 votes

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 by

2 Answers

Best answer
23 votes
23 votes

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}$

edited by
2 votes
2 votes

answer will be 6 page fault

Answer:

Related questions

22 votes
22 votes
5 answers
3
go_editor asked Sep 28, 2014
13,501 views
A system contains three programs and each requires three tape units for its operation. The minimum number of tape units which the system must have such that deadlocks nev...