Question: Please write in one C++ file Write a C++ program that performs runs of the following process scheduling algorithms Shortest remaining time (SRT) preemptive Round
Please write in one C++ file
Write a C++ program that performs runs of the following process scheduling algorithms
Shortest remaining time (SRT) preemptive
Round robin (RR) preemptive
Run each scheduling algorithm for 100 quanta (time slices), labeled 0 through 99. Before each run of an algorithm, create 20 simulated processes. Each simulated process is simply a small data structure that stores information about the process that it represents. For each simulated process, randomly generate:
An arrival time: a float value from quanta 0 through 99.
An expected total run time: a float value from 0.1 through 10 quanta.
A priority: integer 1, 2, 3, or 4 (1 is highest)
Assume only one CPU and one ready queue. Sort the simulated processes in the ready queue by arrival time. Your process scheduler can do process switching only at the start of each time quantum. For this assignment, only consider CPU time for each process (no I/O wait times, no process switching overhead).
Each simulation run should last until the completion of the last process, even if it goes beyond 100 quanta. No process should get the CPU for the first time after time quantum 99. Run each algorithm 5 times to get averages for the statistics below. Before each run, clear the process queue and create a new set of simulated processes.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
