Write an algorithm to find the total number of units of memory allocated/deallocated by the server one after processing all the request
Buddy memory allocation is an algorithm for determining the total amount of units of memory allocated/deallocated by the server after processing all requests:
A list contains all free nodes that are always powers of two.
When an allocation request comes in, start with the smallest block and work your way up to the largest.
If such a block is identified, allocation is completed, and the list is then traversed upwards until a large enough block is found.
Then split the blocks again, one for adding to the next free list and the other for traversing down till we reach the destination.
If no allocations were discovered, just return null.
Comments
Leave a comment