Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Architecture A Quantitative Approach

Authors: John L. Hennessy, David A. Patterson

4th edition

123704901, 978-0123704900

More Books

Students also viewed these General Management questions

Question

=+b) If you identified a seasonal component, what is the period?

Answered: 1 week ago

Question

How has technology had an impact on product design?

Answered: 1 week ago