Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You are to write two memory allocation routines to implement Knuth's boundary - tag method. You should write the routines in C using the default
You are to write two memory allocation routines to implement Knuth's boundarytag method. You should write the routines in C using the default bit byte pointers of gcc with allocations made in byte increments. You should use an integrated, doublylinked free list. On allocate, use the firstfit policy to choose a free block. If the block is large enough, split from the bottom of the free block, leaving a smaller free block in the free list. On release, return the free block to the head of the free list and perform coalescing with adjacent blocks when possible. The list is doublylinked so that you can easily remove a free block when you allocate a complete block and when you coalesce a returned block with two adjacent free blocks.
Your routines will manage a fixedsize region of memory for allocation and release requests. Your two routines are not allowed to call malloc sbreak or any other system routine to allocate memory on your behalf. The fixedsize region of memory you manage will be made available to your routines as a set of blocks on the free list, and a pointer to the header node of the free list will be available as the global variable "freelist".
The skeleton of the program is provided as alloc.c Download alloc.cin the files section of the Canvas site for the course. The comments in the skeleton discuss the project requirements in more detail.
Turn in a completed program with the name alloc.c using Gradescope
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started