324_Book

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: ts, minimum block sizes, and header encodings. The general approach for determining the block size is to round the sum of the requested payload and the header size to nearest multiple of the alignment requirement (in this case eight bytes). For example, the block size for the malloc(1) request is · ½ rounded up to eight. The block size for the malloc(13) request is ½¿ · ½ rounded up to 24. Request malloc(1) malloc(5) malloc(12) malloc(13) Block size (decimal bytes) 8 16 16 24 Block header (hex) 0x9 0x11 0x11 0x19 Problem 10.7 Solution: [Pg. 535] The minimum block size can have a significant effect on internal fragmentation. Thus, it is good to understand the minimum block sizes associated with different allocator designs and alignment requirements. The tricky part is to realize that the same block can be allocated or free at different points in time. Thus, the minimum block size is the maximum of the minimum allocated block size and the minimum free block size. For example, in the last subproblem, the minimum allocated block size is a four-byte header and a one-byte payload rounded up to eight bytes. The minimum free block size is a four-byte header and four-byte footer, which is already a multiple of eight and doesn’t need to be rounded. So the minimum block size for this allocator is eight bytes. Alignment Single-word Single-word Double-word Double-word Allocated block Header and footer Header, but no footer Header and footer Header, but no footer Free block He...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online