Write a C Program for CPU scheduling algorithm for First Come First Serve (FCFS)
Theory
In First Come First Serve (FCFS) the process which comes first will be served first by the processor.
The processor gets processes from the ready Queue. In FCFS we calculate average waiting time of all the processes.
Waiting time (n) = waiting time (n-1) + Burst time (n-1)
Turnaround time (n)= waiting time(n)+Burst time(n)
Average waiting time = Total waiting Time / Number of process.
Average Turnaround time = Total Turnaround Time / Number of process
Program
Input
Enter number of processes:3
Enter Burst Time for Process 0:24
Enter Burst Time for Process 1:3
Enter Burst Time for Process 2:3
Output
Process burst Time Waiting Time Turnaround Time
P0 24 0 24
P1 3 24 27
P2 3 27 30
Average Waiting Time: 17.000000
Average Turnaround Time: 27.000000