FCFS Scheduling Algorithm
FCFS Scheduling Algorithm
int main()
int n,bt[30],wait_t[30],turn_ar_t[30],av_wt_t=0,avturn_ar_t=0,i,j;
printf("Please enter the total number of processes(maximum 30):"); // the maximum process that
be used to calculate is specified.
scanf("%d",&n);
printf("P[%d]:",i+1);
scanf("%d",&bt[i]);
wait_t[0]=0;
for(i=1;i<n;i++)
wait_t[i]=0;
for(j=0;j<i;j++)
wait_t[i]+=bt[j];
for(i=0;i<n;i++)
turn_ar_t[i]=bt[i]+wait_t[i];
av_wt_t+=wait_t[i];
avturn_ar_t+=turn_ar_t[i];
printf("\nP[%d]\t\t%d\t\t\t%d\t\t\t\t%d",i+1,bt[i],wait_t[i],turn_ar_t[i]);
av_wt_t/=i;
return 0;
Burst time = 5, 8, 12
Output-:
Processes Burst Waiting Turn around
1 5 0 5
2 8 5 13
3 12 13 25
P[1]:10
P[2]:5
P[1] 10 0 10
P[2] 5 10 15