Question: Write a simulator that compares between the following memory management algorithms: First Fit, Next Fit and Best Fit. The simulator will read the following file,

Write a simulator that compares between the following memory management algorithms: First Fit, Next Fit and Best Fit.

The simulator will read the following file, which has the number of coming programs, the required pages for each program and the allocation program.

Each program has a different allocation time.

Assume the total memory size is 20 pages and each program could ask for any number of page between 1 and 10.

You need to print the memory after each change (ex. every 1 seconds) and the current system time (ex. a loop counter).

Compare about the above algorithms: average finished time for all jobs, average waiting time for all jobs and finished time for all jobs. Which algorithm is the best?

Example of the input files:

NumberOfPrograms 6

PName #Pages #AllocationTime

P1 5 6

P2 3 7

P3 4 4

P4 7 3

P5 5 7

P6 10 5

Example of output file:

First Fit

Timer Memory Pages

1 11111222333344444440 (1 means P1, 2 means P2,., 0 means free page)

2 11111222333344444440

3 11111222333344444440

4 11111222333355555000

5 11111222000055555000

6 11111222000055555000

7 00000222000055555000

8 ..................

9 ..................

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!