Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Can someone write the java code for the 4 scheduling process above. Please pay special attention to the the test case i provided and use
Can someone write the java code for the 4 scheduling process above. Please pay special attention to the the test case i provided and use it to check your calculations. Please make sure that there is a correct output for all 4 scheduling processes. If everything is correct like in the test case i will give thumbs up. Thank you.
(I will accept c code. Thank you)
Write a java program that simulates the behavior of the following four scheduling algorithms: FCFS, SJF, SRT, RR. The program input must be like the following: Enter the number of processes (the processes will be named p1, p2, p3 and so on) Enter the arrival time of each process in the system. Enter the CPU burst time of each process. Enter the time quantum for the RR scheduling. The output of the program will be the following: For each algorithm, the program will calculate the timing sequence of each process. For each algorithm, the program will output the individual wait time for each process and the overall average waiting time. For each algorithm, the program will output the individual turnaround time for each process and the overall average turnaround time. Input: Processes Arrival Time 0 P1 CPU Time 5 2 P2 2 P3 3 6 P4 5 3 RR Time Quantum = 3 units Output: FCFS: P1 0-5, P2 5-7, P3 7-13, P4 13-16 SJF: P1 0-5, P2 5-7, P4 7-10, P3 10-16 SRT: P1 0-2, P2 2-4, P1 4-7, P4 7-10, P3 10-16 RR: P1 0-3, P2 3-5, P1 5-7, P3 7-10, P4 10-13, P3 13-16 Wait Time: RR Processes P1 FCFS 0 SJF 0 SRT 2 2 P2 3 3 0 1 P3 4 7 7 7 8 2 2 P4 Average Wait 5 3.75 3.75 3 2.75 Turnaround Time: FCFS SJF SRT RR Processes P1 5 5 7 7 P2 5 5 2 3 P3 10 13 13 13 P4 11 5 5 8 7.75 Average Turnaround 7.75 7 6.75Step 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