Open In App

ISRO | ISRO CS 2018 | Question 67

Like Article
Like
Save
Share
Report

A computer has 1000 K of main memory. The jobs arrive and finish in the sequence

Job 1 requiring 200 K arrives
Job 2 requiring 350 K arrives
Job 3 requiring 300 K arrives
Job 1 finishes
Job 4 requiring 120 K arrives
Job 5 requiring 150 K arrives
Job 6 requiring 80 K arrives

Among best fit and first fit, which performs better for this sequence?
(A) First fit
(B) Best fit
(C) Both perform the same
(D) None of the above


Answer: (A)

Explanation: Main memory = 1000K

Job 1 requiring 200 K arrives
Job 2 requiring 350 K arrives
Job 3 requiring 300 K arrives and assuming continuous allocation:

Free memory = 1000 − 850(200 + 350 + 300) = 150 K (till these jobs first fit and best fit are same)
Since, job 1 finishes, Free memory = 200 K and 150 K

Case 1: First fit

Job 4 requiring 120 K arrives
Since 200 K will be the first slot, so Job 4 will acquire this slot only. Remaining memory = 200 – 120 = 80 K

Job 5 requiring 150 K arrives
It will acquire 150 K slot

Job 6 requiring 80 K arrives
It will occupy 80 K slot, so, all jobs will be allocated successfully.

Case 2: Best fit

Job 4 requiring 120 K arrives
It will occupy best fit slot which is 150 K. So, remaining memory = 150 − 120 = 30 K

Job 5 requiring 150 K arrives
It will occupy 200 K slot. So, free space = 200 − 150 = 50 K

Job 6 requiring 80 K arrives
There is no continuous 80 K memory free. So, it will not be able to allocate.

So, first fit is better.
Option (A) is correct.

Quiz of this Question


Last Updated : 09 Jul, 2018
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads