0
14kviews
Given memory partitions of 100 KB, 500 KB, 200 K, 300 KB, & 600 KB, how would each off the first-fit, best-fit and worst-fit algorithms place processes of 212KB, 417KB, 112KB, and 426KB in order)?
0
2.0kviews

## Partition Allocation Methods Problem

Given Memory Partition = 100 KB, 500 KB, 200 KB, 300 KB, and 600 KB (in order),

how would each algorithm place processes of size 212 KB, 417 KB, 112 KB, and 426 KB (in order)?

## First Fit:

In the first fit, a partition is allocated which is first sufficient from the top of Main Memory.

• 212 KB is put in a 500 K partition. 212 KB => 500 KB partition, leaves a 288 KB partition
• 417 KB is put in a 600 K partition. 417 KB => 600 KB partition, leaves a 183 KB partition
• 112 KB is put in a 288 K partition (new partition 288 KB = 500 KB - 212 KB). 112 KB => 288 KB partition, leaves a 176 KB partition
• 426 KB must wait. Because 426 KB would not be able to allocate, no partition large enough!

## Best-fit:

Allocate the process to the partition which is the first smallest sufficient partition among the free available partition.

• 212 KB is put in a 300 KB partition. 212 KB => 300 KB, leaving a 88 KB partition
• 417 KB is put in a 500 KB partition. 417 KB => 500 KB, leaving a 83 KB partition
• 112 KB is put in a 200 KB partition. 112 KB => 200 KB, leaving a 88 KB partition
• 426 KB is put in a 600 KB partition. 426 KB => 600 KB, leaving a 174 KB partition

## Worst-fit:

Allocate the process to the partition which is largest sufficient among the freely available partitions available in the main memory.

• 212 KB is put in a 600 KB partition. 212 KB => 600 KB, leaving a 388 KB partition
• 417 KB is put in a 500 KB partition. 417 KB => 500 KB, leaving a 83 KB partition
• 112 KB is put in a 388 KB partition. 112 KB => 388 KB, leaving a 276 KB partition
• 426 KB must wait. Because 426 KB would not be allowed to allocate as no partition is large enough!

In this problem, the Best-Fit Algorithm performed the best among all the three algorithms, because it was the only algorithm that meet all the memory requests.