The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+14 votes
1.4k views

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

asked in Operating System by Veteran (59.5k points)
edited by | 1.4k views
0
This question is incorrectly categorized. It should be in memory allocation not page replacement.
0
In this question if they give that use compaction then it can be allocated by any fit scheme

Please explain
+1
they should mention whether static our dynamic allocation is used

3 Answers

+23 votes
Best answer

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

So, request for $300$ will be satisfied by $350$ size block reducing the free size to $50$.
Request for $25$, satisfied by $125$ 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 best fit strategy, a block request is satisfied by the smallest block in that can fit it.
So, request for $300$ will be satisfied by $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, request for $50$ cannot be satisfied as the two $25$ size blocks are not contiguous.

So, answer (B).

answered by Veteran (357k points)
edited by
+3
partition is static or dynamic is not mentioned.
0
In best-fit strategy, a block request is satisfied by the smallest block in that can fit it

In best-fit strategy, a block request is satisfied by the block having minimum internal fragmentation

 

are both of these statements equivalent?
0

http://www.techtud.com/preparation/introduction-0 this link more clarify this question

0
@arjun sir

why we are allocating more jobs in single block?is it fixed partition
0
In this case, we have variable partitioning, that's why. When a job comes and can be fitted in one of the free spaces available then that job is placed there which leaves out free space if any ( when the job requires less space than the corresponding free portion of memory where it is placed). Here there is no partition of memory. when the job finishes that portion of memory again becomes free. If there is adjacent free space then they coalesce with each other to make a larger free space.
+5 votes
it should be b) because.. by using best fit external fragmentation will be there..
answered by Active (1.1k points)
–1 vote
Only first fit
answered by Loyal (7.3k points)
0
Explanation ???
0

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
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
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.. ?


Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,440 questions
46,623 answers
139,377 comments
57,024 users