question archive Explain all your steps and explain how do you determine the answer! The table on the back page shows the addresses and contents of some selection of blocks on a heap on a big-endian machine
Subject:Computer SciencePrice: Bought3
Explain all your steps and explain how do you determine the answer!
The table on the back page shows the addresses and contents of some selection of blocks on a heap on
a big-endian machine. The header/footer struct is exactly as, i.e.
struct header {
unsigned int length :29,
unsigned int NOT_USED :2,
unsigned int allocated :1 /* 1 means ALLOCATED */
}; /* 0 means FREE */
any additional pointers, if they exist, would be stored in the order: PREVIOUS, NEXT.
1. What is the address of the header of the first allocated block?
2. What is its length?
3. How much user-data can be stored in this block?
4. What was the address returned by malloc( ) when this header was set?
5. What is the address of the header of the first free block?
6. What is its length (including header and footers)?
7. How much data could potentially be stored in this block?
8. If this heap uses a simple explicit free list, what is the address of the next free block?
Address | Value |
---|---|
0x1770 | 0x00000011 |
0x1774 | 0x000000ad |
0x1778 | 0x000000e4 |
0x177c | 0x00000011 |
0x1780 | 0x00000010 |
0x1784 | 0x00000000 |
0x1788 | 0x000017a8 |
0x178c | 0x00000010 |
0x1790 | 0x00000019 |
0x1794 | 0x0000001b |
0x1798 | 0x000000db |
0x179c | 0x000000b4 |
0x17a0 | 0x0000004a |
0x17a4 | 0x00000019 |
0x17a8 | 0x00000010 |
0x17ac | 0x00001780 |
0x17b0 | 0x00000000 |
0x17b4 | 0x00000010 |
0x17b8 | 0x00000019 |
0x17bc | 0x0000000e |
0x17c0 | 0x0000005b |
0x17c4 | 0x0000004b |
0x17c8 | 0x0000007f |
0x17cc | 0x00000019 |
0x17d0 | 0x00000011 |
0x17d4 | 0x000000bf |
0x17d8 | 0x0000005e |
0x17dc | 0x00000011 |