159.342 - Operating Systems and Networks
Assignment #3 (due on 11/Jun)
Memory Management Using the Buddy System Strategy
OBJECTIVE:
The main objective in this assignment is to implement the Buddy System memory
management strategy by writing two functions that implement the same functionalities as
the C Standard library’s malloc() and free(). You should apply your knowledge of memory
management concepts, so the functions are as efficient as possible. The buddy system will
be characterised and compared against the existing C Standard library functions based on
ACTUAL RUNNING TIME and MEMORY USAGE. Given a large block of contiguous memory to manage, your functions should be able to fulfil
a series of memory allocation and deallocation requests. In your implementation, you are
not allowed to use the built-in malloc, free, new, delete or any other memory allocators that
come from other third-party libraries. START-UP CODES:
The start-up codes provide a test routine that makes successive calls for memory
allocations and deallocations, involving a replaceable implementation of MALLOC and
FREE. Functions for measuring the actual running time and total memory usage of the
memory management strategy are also provided.
///////////////////////////////
// TEST ROUTINE
///////////////////////////////
#ifdef RUN_COMPLETE_TEST
cout << "\n\n executing " << NO_OF_ITERATIONS << " rounds of combinations of memory allocation and deallocation..." <<
endl;
for(i=0;i