A computer installation has 1000 KB of main memory. Jobs arrive and finish in…
2018
A computer installation has 1000 KB of main memory. Jobs arrive and finish in the following sequence.
Job 1 requiring 200 KB arrives
Job 2 requiring 350 KB arrives
Job 3 requiring 300 KB arrives
Job 1 finishes
Job 4 requiring 120 KB arrives
Job 5 requiring 150 KB arrives
Job 6 requiring 70 KB arrives
Between best-fit and first-fit, which one will perform better for this process sequence?
- A.
First-fit
- B.
Best-fit
- C.
Both, first-fit and best-fit
- D.
Cannot be determined
Attempted by 126 students.
Show answer & explanation
Correct answer: A
Memory starts at 1000 KB. Jobs 1 (200 KB), 2 (350 KB), and 3 (300 KB) allocate sequentially, leaving a 150 KB hole at the end.
Job 1 finishes, creating a 200 KB hole at the start. Job 4 (120 KB) arrives next.
First-fit uses the start hole, leaving an 80 KB fragment. Best-fit uses the end hole (150 KB), leaving a 30 KB fragment.
Job 5 (150 KB) fills the end hole in First-fit, leaving only the 80 KB fragment. Best-fit takes the start hole, leaving a 50 KB fragment.
Job 6 (70 KB) fits in First-fit's 80 KB fragment but fails Best-fit's largest available hole of 50 KB.
Thus, First-fit performs better because it avoids the fragmentation that prevents Job 6's allocation.