FCFS : First Come First Served is an Non-Preemptive scheduling progream. First In First Out strategy assigns priority for process the order. The process that requests the CPU first is allocated the CPU first order. It`s easily implemented with a FIFO queue for managing the tasks. As the process come in, they are put at the end of the queue/waiting line. As the CPU finishes each task, when 1 is complete another one will get access.

process scheduling algorithm in c

#include <stdio.h>
int main(){
int s[10],i,diu,j,ss,sum,aa,k; k=0;i= 0; j=0; ss=0; sum=0;
printf(" Enter the number of process you want : ");
scanf("%d", &diu);

for (i=0; i<diu; i++){
printf(" Enter the value %d: ", i);
scanf("%d", &s[i]);
}

printf(" \n \nProcess Start End \n");
for (i = 0; i <diu; i++){
ss+=s[i];
printf("\n P%d     %d      %d \n",i ,j,ss);
sum=sum+j;
j=ss;

}
aa=sum/diu;
printf("\n Avg waiting time: %d \n",aa);
return (0);
}
Leave a reply