Question: Q3. (20 pts) Consider an allocator that uses an implicit free list for which the block format is defined below: Each memory block consists of

Q3. (20 pts) Consider an allocator that uses an implicit free list for which the block format is defined below: Each memory block consists of a 2 byte header, the payload and possibly some additional padding. Each memory block, either allocated or free, has a size that is a multiple of 4 bytes. Thus, only the 14 higher order bits in the header are needed to record block size, bit 1 is unused and is always O, bit O indicates the use of the current block: 1 for allocated, 0 for free. For example, suppose we have an allocated block with a block size of 24 (Ox18) bytes, then its header would be Ox0018 | 0x1 = 0x0019 Determine the block sizes and header values that would result from the following sequence of malloc requests. Note that, the block sizes are rounded up to the nearest multiple of 4 bytes. Request Block size Block header (hex) (decimal bytes) malloc(1) 4 Ox0005 malloc(5) malloc(12) malloc
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
