/OS-Memory-Allocation-Algorithms-Simulation

The two programs included in this repository simulate the Buddy System, First Fit, Next Fit, Best Fit and Worst Fit memory allocation algorithms used in numerous operating systems. Tree data structure was used for the implementation of buddy system where as two separate doubly link lists have been used to keep the record of the holes and the memory allocated to the processes in case of First Fit, Next Fit, Best Fit and Worst Fit algorithms simulation. The buddy system is a memory allocation and management algorithm that manages memory in power of two increments. In the first fit, the approach is to allocate the first free partition or hole large enough which can accommodate the request. It finishes after finding the first suitable free partition. The best fit deals with allocating the smallest free partition which meets the requirement. This algorithm first searches the entire list of free partitions and considers the smallest hole that is adequate. Next fit is a modified version of first fit. It begins as first fit to find a free partition. When called the next time it starts searching from where it left off instead of the beginning. In case of worst fit, the approach is to locate largest available free partition so that the left over portion will be big enough to be useful again.

Primary LanguageC++MIT LicenseMIT

Stargazers