Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a C PROGRAM that display the choices of the 4 CPU SCHEDULING ALGORITHM, the choosen, after the user choose, it will proceed to the
Write a C PROGRAM that display the choices of the 4 CPU SCHEDULING ALGORITHM, the choosen, after the user choose, it will proceed to the inputs of the algorithm and it will calculate after it got enter the inputs.
The photos are examples of each algorithm, on how it is calculated by entering the Input and what is the output:
CPU Scheduling Program in C 1. First Come First Serve (FCFS) 2. Shortest-Job-First (SJF) Scheduling 3. Priority Scheduling 4. Round Robin Scheduling Please enter any options (1/2/3/4/5/6): 1 First Come First Serve (FCFS) Enter burst time for each process: P[1] : 24 P[2] : 3 P[3] : 7 PID Burst Time i waiting Time | Turnaround Time 1 24 e 24 2 24 27 3 7 27 34 Total Waiting Time : 51 Average Waiting Time : 17.00 Total Turnaround Time : 134 Average Turnaround Time : 44.67 GANTT CHART P1 P2 P3 24 27 Process returned e (exe) Press any key to continue. execution time : 4.485 5 Please enter any options (1/2/3/4/5/6): 2 Shortest-Job-First (SJF) Scheduling Enter The Total Number of Process: 4 Enter CBT of Process: Gantt. Chart P4 | P1 | 23 | 22 | be 03 09 16 24 Process CBT Waiting Time Turn Around Time 6 P[4] P[1] P[3] P[2] 3 9 16 3 9 16 24 8 Total Waiting Time: Total Turn Around Time: 13 Please enter any options (1/2/3/4/5/6): 3 Priority Scheduling enter number of process : 5 enter brust time and priority P1 4 5 P2 3 6 P3 4 1 P4 6 2 P5 2 process Priority Brust time Gaint chart : 1 2 3 4 5 : 5 6 1 2 3 : 4 3 4 6 2 P3 P4 PS P1 12 P2 16 waiting time: 0 4 10 waiting time for all process 42 Average Waiting time 8.400000_ Please enter any options (1/2/3/4/5/6): 4 Round Robin Scheduling Average Waiting time : 12.75 Average turn Around time : 19.25 Process ID Execution time Arrival Tine 1 8 0 2 4 1 AWN 9 2 3 4 NM 3 Process id 2 5 Haiting time 9 11 16 15 Turn around time 13 16 WAN 24 1 3 24 GANTT CHART 1 2 3 4 1 2 3 3 4 1 2 3 4 1 2 341 341 9 10 11 12 13 14 15 16 17 18 19 20 OT 1 2 3 4 5 6 2 8 3 1 3 1 3 3 20 21 22 23 24 25 26Step 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