Skip to content

msranjana/memory_allocation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Memory Allocation Techniques

A C++ implementation of memory allocation strategies: first fit, best fit, and worst fit.

First Fit Algorithm

  1. Allocates the first available hole it finds.
  2. Tends to leave more holes in the memory.
  3. Leaves more memory fragmentation.

Best Fit Algorithm

  1. Allocates the smallest hole that is big enough to accommodate the requested memory block.
  2. Tends to leave fewer holes in the memory.
  3. Has better memory utilization and less fragmentation compared to First Fit and Worst Fit.

Worst Fit Algorithm

1 .Allocates the largest hole that is big enough to accommodate the requested memory block. 2. Tends to leave the most holes in the memory. 3. Has worse memory utilization and more fragmentation compared to Best Fit.

Output

1. First Fit

image

2. Best Fit

image

3. Worst Fit

image

Conclusion

Best Fit typically strikes a balance between memory utilization and fragmentation, often performing better than first fit and worst fit in terms of reducing fragmentation while still using memory effectively. First Fit is straightforward and efficient in terms of time complexity but can lead to moderate fragmentation and suboptimal memory utilization. Worst Fit is simple to implement but often results in the highest fragmentation and can be inefficient in terms of memory utilization. Hence the Best Fit algorithm tends to have better memory utilization and less fragmentation compared to the First Fit and Worst Fit algorithms. In conclusion, the choice of allocation strategy depends on the specific characteristics of the workload and system requirements

Releases

No releases published

Packages

No packages published

Languages