Question
Please modify this base code so that it properly outputs the correct block no.'s for the following memory allocations.... - first fit - needed output
Please modify this base code so that it properly outputs the correct block no.'s for the following memory allocations....
- first fit - needed output for block no: 1,5,1,1,3, respectively in that order
- best fit- needed output for block no: 4,5,2,3,1, respectively in that order
- worst fit- needed output for block no: 1,5,3,3, Not allocated, respectively in that order
- next fit - needed output for block no: 1,5,1,1,3, respectively in that order
***** Logic for the fits******
First Fit Implementation: a. Input memory blocks with size and processes with size. b. Initialize all memory blocks as free. c. Start by picking each process and check if it can be assigned to current block. d. If size-of-process <= size-of-block if yes then assign and check for next process. e. If not then keep checking the further blocks.
2. Best Fit Implementation: a. Input memory blocks with size and processes with size. b. Initialize all memory blocks as free. c. Start by picking each process and find the minimum block size that can be assigned to current process i.e., find min(blockSize[1], blockSize[2],.....blockSize[n]) > processSize[current], if found then assign it to the current process. d. If not, then leave that process and keep checking the further processes.
3. Worst Fit Implementation: a. Input memory blocks with size and processes with size. b. Initialize all memory blocks as free. c. Start by picking each process and find the maximum block size that can be assigned to current process i.e., find max(blockSize[1], blockSize[2],.....blockSize[n]) > processSize[current], if found then assign it to the current process. d. If not, then leave that process and keep checking the further processes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
To modify the code for First Fit Best Fit Worst Fit and Next Fit memory allocation algorithms the basic structure of the code will remain the same wit...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