4,348 views
7 votes
7 votes
Given memory partitions of 100kB, 700kB, 500kB, 200kB, 100kB (in order) and requests for processes of size 112kB, 516kB, 180kB, 320kB, 190kB (in order) are placed. According to which of the following algorithms(s) all requests can be successfully placed in memory?

A) First Fit

B) Best Fit

C) Both First Fit and Worst Fit

D) Best Fit and Worst Fit

1 Answer

Best answer
6 votes
6 votes

Only first fit satisfies the above condition..Let us see how.

We have partitions 100 kB , 700 kB , 500 kB , 200 kB  and 100 kB

a) First fit allocation strategy is followed :

So we look for first available vacant slot scanning from left to serve the process.

i) Process needing 112 kB will be allocated in 700 kB slot..Therefore , now memory left in this slot

or we can say size of new slot =  700  -  112     =   588 kB

ii) Next request is of 516 kB which gets places in 588 kB slot.So space remaining in this slot =  588 - 516 = 72 kB

iii) Next request is of 180 kB which gets placed in 500 kB slot so space remaining here = 500 - 180 = 320 kB

iv) Next request is of 320 kB which gets placed in 320 kB slot.

v)  Next request is of 190 kB which gets placed in 200 kB slot

So all processes are able to be calculated successfully.

b) Using best fit strategy : 

Here we look for the smallest possible slot which satisfies the request , be it in the end.

i) Process needing 112 kB will be allocated in 200 kB slot..Therefore , now memory left in this slot

or we can say size of new slot =  200  -  112     =   88 kB

ii)  Next request is of 516 kB which gets places in 700 kB slot.So space remaining in this slot =  700 - 516 = 184 kB

iii) Next request is of 180 kB which gets placed in 184 kB slot so space remaining here = 184 - 180 =  4 kB

iv) Next request is of 320 kB which gets placed in 500 kB slot so space remaining here = 500 - 320  =  180 kB.

v) Now we have free spaces of 100 kB , 4 kB , 180 kB , 88 kB and 100 kB.So 190 kB request cannot be satisfied.

c) Using Worst Fit Strategy :

In this we allocate a process the slot which is largest among the available free slots and also  satisfies its memory request.

i) Process needing 112 kB will be allocated in 700 kB slot..Therefore , now memory left in this slot

or we can say size of new slot =  700  -  112     =   588 kB

ii)  Next request is of 516 kB which gets places in 588 kB slot.So space remaining in this slot =  588 - 516 = 72 kB

iii) Next request is of 180 kB which gets placed in 500 kB slot so space remaining here = 500 - 180 =  320 kB

iv) Next request is of 320 kB which gets placed in 320 kB slot.

v) Next request is of 190 kB which gets placed in 200 kB slot.

Thus worst fit is also successfully implemented.

Therefore , first fit and worst fit are valid here but not best fit allocation strategy

Hence , option  C is correct here.

selected by

Related questions

2 votes
2 votes
1 answer
2
joleyasarthak asked Nov 21, 2022
920 views
Please help with the minimum value. Problem is from the gate wallah study handout.
0 votes
0 votes
0 answers
3
DhruvaKashyap asked Dec 29, 2023
164 views
I have not been able to answer many of the Graph theory questions, I feel my comprehension of the topic is inadequate, could someone guide me to some reference material I...
0 votes
0 votes
0 answers
4
Answers Copied asked Jan 6, 2023
346 views
Does anyone have updated e-study materials, especially the study handouts provided by big coaching?