Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In context of a heap being managed by a buddy system (memory allocation). We hav

ID: 3545948 • Letter: I

Question

In context of a heap being managed by a buddy system (memory allocation). We have 2 ways to implement this system:


1) In the lazy system, free blocks are allowed to accumulate in the free lists, and the only time free blocks are merged is when an allocate cannot be completed.  That is, when the free lists for the requested size and all larger sizes are null.  At that point, all free lists are searched for free blocks that can be merged, and all possible mergers are done.


2) In the eager system, each time a block is deallocated, a search is made of the appropriate free list to see if it can be merged with its buddy.  In this case, we can guarantee that two buddies originally split from the same block will never both be included in any free list.


If we used a virtual memory system, which (lazy or eager) is likely to lead to more page faults?

Explanation / Answer

Page faults will be more in the lazy system. This is because the eager system always has free memory blocks of sufficient size even before a page is requested(All similar sized blocks are merged as soon as they are deallocated). However, in the case of lazy system, memory is being freed for merging only when a new page is requested. Hence, in the lazy system, pages will be removed from memory to allocate memory to new pages more frequently than in the eager system. Hence, page faults will be more in the lazy system.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote