Question
** Please add notes if any code is needed to be attached to other code and where to put them** **Explain thoroughly if possible** Compare
** Please add notes if any code is needed to be attached to other code and where to put them**
**Explain thoroughly if possible**
Compare the performance of the two CPU scheduling algorithms SJF and RR.
Description/Concept:
A system snapshot contains N number of processes, each with unique integer ID and varied burst lengths
All the processes are assumed to appear/arrive at the same time on the system
Each scheduling algorithm generates an ordering according to which the processes would be executed
The scheduling algorithms calculate the ATT (average turnaround time)
Assignment
Write a program (in Java or Python) simulating a simple CPU scheduler to evaluate, based on average turnaround time (ATT), the two CPU scheduling algorithms Shortest Job First (SJF) and Round-robin (RR). Note: this program must not be an interactive program. That is, the program does not require any input from the user.
1. Write a generator for creating the snapshot of the system with 5 processes where each process has the following attributes:
i) an identifier (a unique random integer value between 0 and 9) Note: the ID is unique; no two processes have the same ID value and must be within the specified range [0 9] ii) a burst length (a random integer value between 20 99) Note: burst length may not be unique, but must be within the specified range [20 99]
2. Display the generated snapshot of the system in tabular format as follows (order the entries in increasing ID values):
Process ID | Burst-length
3. We assume that all processes arrived at the same time and are ready for scheduling. We also assume that time quantum for round-robin (RR) algorithm is 25. Using this information, for each of the two algorithms, calculate turnaround time for each process. Display the evaluation result in tabular format as follows:
Scheduling algorithm name | Process ID | Burst-length | Turnaround time
The table should have the data grouped by scheduling algorithm and for each algorithm, processes should be ordered by increasing order of IDs.
4. Based on the snapshot and calculations, display average turnaround time (ATT) for the two algorithms as follows:
Scheduling algorithm name | Average turnaround time
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