Answer to Question #282344 in Python for Swapna

Question #282344

Write an algorithm to find the total number of units of memory allocated deallocated by the server 1 after preprocessing all the requests

1
Expert's answer
2021-12-24T01:20:26-0500

An algorithm to find the total number of units of memory allocated/deallocated by the server one after processing all the requests is Buddy memory allocation:

  • A list contains all free nodes, which are all powers of 2 at all times.
  • When the request of allocation comes, first go through with the smallest block than the bigger one.
  • If such a block is found then the allocation is done, then traverse the list upwards until a big enough block is found.
  • Then keep splitting the blocks-one for adding to the next free list, one to traverse down till we reach the target.
  • If no allocations found, then simply return null.

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS