recategorized by
1,020 views
1 votes
1 votes

Determine the number of page faults when references to pages occur in the order - $1, 2, 4, 5, 2, 1, 2, 4$. Assume that the main memory can accommodate $3$ pages and the main memory already has the pages $1$ and $2$, with page $1$ having brought earlier than page $2$. (assume LRU i.e. Least-Recently-Used algorithm is applied)

  1. $3$
  2. $4$
  3. $5$
  4. None of the above
recategorized by

2 Answers

Best answer
5 votes
5 votes

Reference String: $1,2,4,5,2,1,2,4$

Frame can contain only $3$ pages, $1$ and $2$ are already present

$1$: Hit, Frame Status: $1,2$

$2$: Hit, Frame Status: $1,2$

$4$: Page fault, Frame Status: $1,2,4$

$5$: Page fault, $1$ will be replaced as per LRU policy, Frame Status: $5,2,4$

$2$: Hit, Frame Status: $5,2,4$

$1$: Page fault, $4$ will be replaced, Frame Status: $5,2,1$

$2$: Hit, Frame Status: $5,2,1$

$4$: Page fault, $5$ will be replaced, Frame Status: $4,2,1$

4 Page faults hence option B) is correct

selected by
Answer:

Related questions

3 votes
3 votes
3 answers
2
Arjun asked Apr 22, 2018
10,797 views
The following $C$ program:{ fork(); fork(); printf("yes"); }If we execute this core segment, how many times the string yes will be printed?Only once2 times4 times8 times
3 votes
3 votes
2 answers
3
Arjun asked Apr 22, 2018
3,727 views
The difference between a named pipe and a regular file in Unix is thatUnlike a regular file, named pipe is a special fileThe data in a pipe is transient, unlike the conte...
4 votes
4 votes
5 answers
4
Arjun asked Apr 22, 2018
4,867 views
Consider a system having $m$ resources of the same type. These resources are shared by $3$ processes $A, B, C,$ which have peak time demands of $3, 4, 6$ respectively. Th...