in Operating System retagged by
925 views
0 votes
0 votes

Determine the number of page faults when references to pages occur in the following 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 been brought earlier than page $2$.(LRU algorithm is used).

  1. $3$
  2. $5$
  3. $4$
  4. None of these.
in Operating System retagged by
by
925 views

2 Answers

2 votes
2 votes

Least Recently Used –
In this algorithm page will be replaced which is least recently used.

 

     1
     2
    

1).now  1 is already in memory so 1 hit

2.)now  2 is already in memory so 2 hit

3.)now  4 is not  in memory so  miss-FIRST page faults

    1
    2
    4

4.)now  5 is not  in memory so miss according to LRU we replace with 1-SECOND page faults

    5
    2
    4

5.)now  2 is already in memory so hit

6.)now  1 is not  in memory so  miss and we replace with 4 number page accordingly LRU-THIRD page faults

    5
    2
    1

7.)now  2 is already in memory so 2 hit

8.)now  4 is not  in memory so miss according to LRU we replace with 5-FOURTH page faults

    4
    2
    1

total number of page faults = 4

 

0 votes
0 votes

just put 1 and 2 is in memory before starting the LRU ALGORITHM….

Answer:

Related questions