in Operating System recategorized by
11,249 views
33 votes
33 votes

A memory page containing a heavily used variable that was initialized very early and is in constant use is removed then

  1. LRU page replacement algorithm is used

  2. FIFO page replacement algorithm is used

  3. LFU page replacement algorithm is used

  4. None of the above

in Operating System recategorized by
11.2k views

2 Comments

0
0
question says – “variable was initialized very early”(this is used to solve the question) and it also says that it is being used frequently so LRU and LFU can’t replace that page but FIFO can . note: if MRU was in option then FIFO and MRU both should’ve been correct .
0
0

2 Answers

37 votes
37 votes
Best answer
FIFO replaces a page which was brought into memory first will be removed first so since the variable was initialized very early. it is in the set of first in pages. so it will be removed answer: (B) if you use LRU - since it is used constantly it is a recently used item always. so cannot be removed. If you use LFU - the frequency of the page is more since it is in constant use. So cannot be replaced.
edited by

4 Comments

@Manu Thakur @rahul sharma 5

Initially, I also thought it should have been "MFU algorithm" but if you consider FIFO then let's take an example of page reference string as : 1,2,3,1,1,1,2,1,1,2,3,1,1,1,4  (3 page frames)

Now if page 4 comes then 1 will be removed.

Here 1 is initialized very early as well as it is in constant use. For LRU and LFU no example will satisfy both conditions.

Please correct me if I am wrong.

0
0
I feel answer is LFU, as it is mentioned "which is in constant use is removed". Can anyone please check and comment on the same.
1
1

Question says that "memory page containing a heavily used variable that was initialized very early and is in constant" but page is removed from the memory. This will happens only if replacement algorithm is FIFO. Otherwise page always remains in the memory.

1
1
0 votes
0 votes

constant use: against LRU

 You use constant to describe something that happens all the time or is always there.  

Heavily used: against LFU

Informal using large quantities of  ..

 

So the answer is FIFO

Answer:

Related questions