53 consists of six allocated blocks each of which is

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: ress p. The remaining macros operate on block pointers (denoted bp), that point to the first payload byte. Given a block pointer bp, the HDRP and FTRP macros (lines 21–22) return pointers to the block header and footer, respectively. The NEXT BLKP and PREV BLKP macros (lines 25–26) return the block pointers of the next and previous blocks, respectively. The macros can be composed in various ways to manipulate the free list. For example, given a pointer bp to the current block, we could use the following line of code to determine the size of the next block in memory: 538 CHAPTER 10. VIRTUAL MEMORY code/vm/malloc.c 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 /* Basic constants and macros */ #define WSIZE 4 /* word size (bytes) */ #define DSIZE 8 /* doubleword size (bytes) */ #define CHUNKSIZE (1<<12) /* initial heap size (bytes) */ #define OVERHEAD 8 /* overhead of header and footer (bytes) */ #define MAX(x, y) ((x) > (y)? (x) : (y)) /* Pack a size and allocated bit into a wor...
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