Question: Next Fit Algorithm in C create two functions: A malloc() replacement called void *my_nextfit_malloc(int size) that allocates memory using the next- fit algorithm. Again, if

Next Fit Algorithm in C create two functions: A malloc() replacement called void *my_nextfit_malloc(int size) that allocates memory using the next- fit algorithm. Again, if no empty space is big enough, allocate more via sbrk(). A free() called void my_free(void *ptr) that deallocates a pointer that was originally allocated by the malloc you wrote above. Your free function should coalesce adjacent free blocks. If the block that touches brk is free, you should use sbrk() with a negative offset to reduce the size of the heap. create a driver program that tests your calls to your mallocs and frees

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!