edited by
11,934 views
26 26 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}$

2 Answers

Best answer
30 30 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
Answer:
Position:
Show:

Related questions

9 9 votes
5 answers 5 answers
8.9k
8.9k views
go_editor asked Sep 28, 2014
8,871 views
In the context of modular software design, which one of the following combinations is desirable?High cohesion and high couplingHigh cohesion and low couplingLow cohesion ...
60 60 votes
5 answers 5 answers
25.0k
25.0k views
go_editor asked Sep 28, 2014
25,015 views
Consider a paging hardware with a $TLB$. Assume that the entire page table and all the pages are in the physical memory. It takes $10$ milliseconds to search the $TLB$ an...
33 33 votes
4 answers 4 answers
15.3k
15.3k views
go_editor asked Sep 28, 2014
15,266 views
An operating system uses shortest remaining time first scheduling algorithm for pre-emptive scheduling of processes. Consider the following set of processes with their ar...
105 105 votes
7 answers 7 answers
26.5k
26.5k views
go_editor asked Sep 28, 2014
26,450 views
There are two elements $x,\:y$ in a group $(G,*)$ such that every element in the group can be written as a product of some number of $x$'s and $y$'s in some order. It is ...