in Operating System recategorized by
11,677 views
25 votes
25 votes

Consider the following heap (figure) in which blank regions are not in use and hatched region are in use.

The sequence of requests for blocks of sizes $300, 25, 125, 50$ can be satisfied if we use

  1. either first fit or best fit policy (any one)

  2. first fit but not best fit policy

  3. best fit but not first fit policy

  4. None of the above

in Operating System recategorized by
11.7k views

4 Comments

First fit is best one compare to all fit.
0
0
0
0
What is the external fragments in best fit for this question
0
0

3 Answers

36 votes
36 votes
Best answer

In the first fit, block requests will be satisfied from the first free block that fits it.

  • The request for $300$ will be satisfied by a $350$ size block reducing the free size to $50$.
  • Request for $25$, satisfied by $150$ size block, reducing it to $125.$
  • Request for $125$ satisfied by $125$ size block.
  • And request for $50$ satisfied by the $50$ size block.

So, all requests can be satisfied.

In the best fit strategy, a block request is satisfied by the smallest block that can fit it.

  • The request for $300$ will be satisfied by a $350$ size block reducing the free size to $50$.
  • Request for $25$, satisfied by $50$ size block as its the smallest size that fits $25$, reducing it to $25$.
  • Request for $125$, satisfied by $150$ size block, reducing it to $25$.

Now, the request for $50$ cannot be satisfied as the two $25$ size blocks are not contiguous.

So, answer (B).

edited by
by

4 Comments

it is given in question that it is heap which allocate blocks dynamically, so more than one processes can be in one block of partition.

please correct me if m wrong
2
2

@Tuhin Dutta

how to assume variable or fixed partition?

1
1

@ankyAS obviously yess

0
0
5 votes
5 votes
it should be b) because.. by using best fit external fragmentation will be there..
0 votes
0 votes
Only first fit

4 Comments

Explanation ???
1
1

Puja Mishra  first of all u have to go through the explanation given by arjun sir...he explained very nicely...And now i tried to make it more clear....

First Fit:

300--------> Chunk_350 bcz all the chunk before it are less than 300

now memory size becomes as

O_50 : F_150 : O_600 : F_50 : O_600, where O denotes occupied and F denotes free.

similarly,

25---------> F_150

memory size becomes as

O_50 : O_25 : F_125 : O_600 : F_50 : O_600

125-------> F_125

memory size becomes as

O_50 : O_25 : O_125 : O_600 : F_50 : O_600

50------> F_50

Best Fit:

300--------> Chunk_350 ( acc. to best fit, a block request is satisfied by the smallest block in that can fit it.)

now memory size becomes as

O_50 : F_150 : O_600 : F_50 : O_600, 

similarly,

25---------> F_50

memory size becomes as

O_50 : F_150  : O_600 : O_25 : F_25 : O_600

125-------> F_150

memory size becomes as

O_50 : O_125 : F_25 : O_600 : O_25 : F_25 : O_600

50------> no space is available....so can't use it...

1
1
Ok ...u should hav ur own views when u r answering any question ... may be u hav ur own approach to solve a question .. otherwise it is unnecessary to answer questions without explaining .... I think u got my point  ..
2
2
i already knew it very clearly....and these are my old answers....that time i answered the question without explaining it... now u got it.. ?
3
3
Answer:

Related questions