Txt that consists of the string hello worldn write a c

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 546 CHAPTER 10. VIRTUAL MEMORY repeat until we find a block that fits. If none of free lists yields a block that fits, 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 fits 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 efficient. 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 first-fit search of a segregated free list approximates a best-fit search of the entire heap. Buddy Systems A buddy system is a special case of segregated fits 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

Ask a homework question - tutors are online