Answered step by step
Verified Expert Solution
Question
1 Approved Answer
The output MUST be THIS: You are required to program Best Fit Memory Management algorithm in C. The program is expected to take 5 processes
The output MUST be THIS:
You are required to program Best Fit Memory Management algorithm in C. The program is expected to take 5 processes with the following attributes: - Process ID (int) - Process Size (int) In order to use Process as a collection of attributes, you can use struct in C language. Please use this link for more information on how to use structs in C. Once you have created a Process struct, create 5 processes in the main method. You are free to hardcode these values using an array of Processes, e.g., {{1,212},{2,417},{3,112},{4,426},{5, 80}} where {1,212} is the first process and {2,417} is second and so on. 1 in the first process is the Process ID, 212 is the Process Size as illustrated above as the attributes of the Process. After populating the Processes, create an int array of memory blocks of size 5 in the main method. You are most welcome to hardcode the block values, e.g., {100,500,200,300,600}. You are also required to create an int array of allocations of size 5 in the main method. Initialize this array with 1 for all the elements. IMPORTANT: You are required to create a void best_fit (int* blocks, struct Process* processes, int allocations (1) method. This method should take in as parameters the pointer to blocks array, pointer to processes array and pointer to allocations array. In this method, you are required to populate the allocations array with appropriate number of the memory block based on Best Fit algorithm. DO NOT display allocations array in this method. Finally, in the main method, you are required to display the allocations of processes with their ID and process size. Please refer to the expected output screenshot for more details
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