This preview shows page 1. Sign up to view the full content.
Unformatted text preview: anizations, the search time would not be constant. Knuth developed a clever and general technique, known as boundary tags, that allows for constant-time coalescing of the previous block. The idea, which is shown in Figure 10.41, is to add a footer (the boundary tag) at the end of each block, where the footer is a replica of the header. If each block includes such a footer, then the allocator can determine the starting location and status of the previous block by inspecting its footer, which is always one word away from the start of the current block.
31 3 21 0 block size a/f header payload (allocated block only) padding (optional) block size a/f footer Figure 10.41: Format of heap block that uses a boundary tag. Consider all the cases that can exist when the allocator frees the current block: 1. The previous and next blocks are both allocated. 2. The previous block is allocated and the next block is free. 3. The previous block is free and the next block is allocated. 534 4. The previous and next blocks are both free. Figure 10.42 shows h...
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.
- Spring '10
- The American