Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Given five memory holes of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order)

ID: 3547132 • Letter: G

Question

Given five memory holes of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of size 212 KB, 417 KB, 112 KB, and 426 KB (in order). Show the final memory space for each of the algorithms. Which algorithm is most efficient?

Given five memory holes of 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order), how would each of the first-fit, best-fit, and worst-fit algorithms place processes of size 212 KB, 417 KB, 112 KB, and 426 KB (in order). Show the final memory space for each of the algorithms. Which algorithm is most efficient?

Explanation / Answer

a) First-fit


The first-fit algorithm selects the first free partition that is large enough to accommodate the request.

First-fit would allocate in the following manner:


212 KB => 500 KB partition, leaves a 288 KB partition

417 KB => KB partition, leaves a 183 KB partition

112 KB => 288 KB partition, leaves a 176 KB partition

426 KB would not be able to allocate, no partition large enough!


b) Best-fit


The best-fit algorithm selects the partition whose size is closest in size (and large enough) to the requested size.

Best-fit would allocate in the following manner:


212 KB => 300 KB, leaving a 88 KB partition

417 KB => 500 KB, leaving a 83 KB partition

112 KB => 200 KB, leaving a 88 KB partition

426 KB => 600 KB, leaving a 174 KB partition


c) Worst-fit


The worst-fit algorithm effectively selects the largest partition for each request.

Worst-fit would allocate in the following manner:


212 KB => 600 KB, leaving a 388 KB partition

417 KB => 500 KB, leaving a 83 KB partition

112 KB => 388 KB, leaving a 276 KB partition

426 KB would not be allowed to allocate as no partition is large enough!


d) Which algorithm makes the most efficient use of memory?


The best-fit algorithm performed the best of the three algorithms, as it was the only algorithm to meet all the memory requests.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote