I'm trying to simulate an OS.
Say I'm given x
bytes of memory.
How would I go about designing a best fit memory allocation system?
I am planning to create an array to store multiple memory block objects, each containing some amount of the total memory size. Example:
Total size is 100 bytes
b1=20, b2=30, b3 =10, b4= 15, b5 =25
- Is there a specific way to go about generating each block size?
- What happens if a process requires 50 memory? None of the blocks will be able to support the process. Should I just refuse the process since none of my blocks can support it or should I merge blocks etc.