Question: ***NB Its A Programming Question and have to code by C. Make sure uplaod the code and program output as well. There is four function

***NB Its A Programming Question and have to code by C. Make sure uplaod the code and program output as well. There is four function in the question allocator(), allocate(int id, int numBytes), release(int id), stats(). make sure right a comment each function when you writing a code.

***NB Its A Programming Question and have to code by C. Make

sure uplaod the code and program output as well. There is four

function in the question allocator(), allocate(int id, int numBytes), release(int id), stats().

Heap allocation management. The heap is essentially one large contiguous space that goes from 0 to n-1 (where n is the size of the heap). The simplest way to manage the heap is to do a first-fit allocation. You start from the beginning and you use the first hole that can satisfy the request. Once found you take what you need to service the request. You are to develop a simple heap management system The size of the heap is to be read in from the command line Create 10 threads that will request a random size of memory less then the heap size, sleep for a random period of time (up to 10 seconds), and then release the memory they were allocated Use 2 linked lists to track the allocated memory partitions and the free memory partitions. The threads will need to be able to access these lists to update them ensure thread safety. The nodes will contain: o ID of process the memory is allocated to (1 to number of threads) o Size of the memory requested (less then the size of the heap) o Start address o End address Write functions that support the following operations: (a) A function allocator() which is called by the threads this function will assign a unique ID to each thread (this can be done simply with a counter) and then call the allocate() function, have the thread sleep and then call the release() function. Heap allocation management. The heap is essentially one large contiguous space that goes from 0 to n-1 (where n is the size of the heap). The simplest way to manage the heap is to do a first-fit allocation. You start from the beginning and you use the first hole that can satisfy the request. Once found you take what you need to service the request. You are to develop a simple heap management system The size of the heap is to be read in from the command line Create 10 threads that will request a random size of memory less then the heap size, sleep for a random period of time (up to 10 seconds), and then release the memory they were allocated Use 2 linked lists to track the allocated memory partitions and the free memory partitions. The threads will need to be able to access these lists to update them ensure thread safety. The nodes will contain: o ID of process the memory is allocated to (1 to number of threads) o Size of the memory requested (less then the size of the heap) o Start address o End address Write functions that support the following operations: (a) A function allocator() which is called by the threads this function will assign a unique ID to each thread (this can be done simply with a counter) and then call the allocate() function, have the thread sleep and then call the release() function

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!