This preview shows page 1. Sign up to view the full content.
Unformatted text preview: 546 CHAPTER 10. VIRTUAL MEMORY repeat until we ﬁnd a block that ﬁts. If none of free lists yields a block that ﬁts, then we request additional heap memory from the operating system, allocate the block out of this new heap memory, and place the remainder in the largest size class. To free a block, we coalesce and place the result on the appropriate free list. The segregated ﬁts approach is a popular choice with production-quality allocators such as the GNU malloc package provided in the C standard library because it is both fast and memory efﬁcient. Search times are reduced because searches are limited to particular parts of the heap instead of the entire heap. Memory utilization can improve because of the interesting fact that a simple ﬁrst-ﬁt search of a segregated free list approximates a best-ﬁt search of the entire heap. Buddy Systems
A buddy system is a special case of segregated ﬁts where each size class is a power of two. The basic idea is that given a heap of ¾Ñ words, we maintain a separate free list for each block size ¾ , where ¼ Ñ. Requested block sizes are rounded up to the nearest power of two. Originally, there is one free block of size Ñ ¾ words. To all...
View Full Document
- Spring '10
- The American