2.5k views

Consider $6$ memory partitions of sizes $200$ $\text{KB}$, $400$ $\text{KB}$, $600$ $\text{KB}$, $500$ $\text{KB}$, $300$ $\text{KB}$and $250$ $\text{KB}$, where $\text{KB}$refers to $\text{kilobyte}$. These partitions need to be allotted to four processes of sizes $357$ $\text{KB}$, $210$ $\text{KB}$, $468$ $\text{KB}$, $491$ $\text{KB}$in that order. If the best-fit algorithm is used, which partitions are NOT allotted to any process?

1. $200$ $\text{KB}$ and $300$ $\text{KB}$
2. $200$ $\text{KB}$ and $250$ $\text{KB}$
3. $250$ $\text{KB}$ and $300$ $\text{KB}$
4. $300$ $\text{KB}$ and $400$ $\text{KB}$

edited | 2.5k views

Option (A) is correct because we have $6$ memory partitions of sizes $200 \ KB, 400 \ KB, 600 \ KB, 500 \ KB, 300 \ KB$ and $250 \ KB$ and the partition allotted to the process using best fit is given below:

$357 \ KB$ process allotted at partition $400 \ KB.$
$210 \ KB$ process allotted at partition $250 \ KB$
$468 \ KB$ process allotted at partition $500 \ KB$
$491 \ KB$ process allotted at partition $600 \ KB$

So, we have left only two partitions $200 \ KB$ and $300 \ KB$

edited
+2

BEST FIT :- We select smallest sufficient partition among free available partition

WORST FIT:-we select largest sufficient partition  among the free available partition

FIRST FIT :-we select first sufficient partition from the top of the memory

NEXT FIT :-we select first sufficient partition from the last of the memory
0

Alternate approach, For the best-fit strategy we can do this as well:

Arrange the given partitions in ascending order so we have

200KB

250KB

300KB

400KB

500KB

600KB
Now allocating the processes to blocks we have

200KB -

250KB - 210KB

300KB -

400KB - 357KB

500KB - 468KB

600KB - 491KB
So 200KB and 300KB are the two blocks which are left.

Ans A

Best fit policy is choose smallest big enough chunk of memory.
0

@Vikrant Singh

sir, how to understand that question is of Fixed partition or variable?

means holes created can be filled or not ?