So as part of a course in OS that I'm taking, I've implemented a memory allocator (just like malloc in C). The free space is stored in a linked-list.
My question in then following: How would I go about testing the various allocation strategies (e.g. first-fit, best-fit and worst-fit). Right now I'm just iterating for a predefined number of times, each time allocating a block of size 1-N byte, where N is something like 20000. Basically I allocate for some iterations then I switch it up by deallocating some of the allocated blocks. Before exiting I check the freelist and calculate the external fragmentation. I'm unsure whether this is the way to go, or is there a better apporach for doing this?
One problem with choosing random block sizes for each strategy is that one can't really compare them if the allocated block sizes differ, right? So the alternativ would be to perform the same test, only now I use the same alloc sizes and free the same blocks when testing each strategy.
Hope this wasn't to confusing :)