This preview shows page 1. Sign up to view the full content.
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 signiﬁcant 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