Consider using contiguous memory allocation. Given five memory partitions of 200KB, 500KB, 100KB, 600KB and 400KB in order, how would the first-fit, best-fit and worst-fit algorithm work with incoming processes of 221KB, 471KB, 127KB, and 451KB

Respuesta :

Answer:

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!

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

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!

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

Explanation: