Round-robin CPU scheduling Program Algorithm in C
#include
#include
main()
{
int st[10],bt[10],wt[10],tat[10],n,tq;
int i,count=0,pop=0,stat=0,xx,sq=0;
float awt=0.0,atat=0.0;
clrscr();
printf("Enter number of processes You Have:");
scanf("%d",&n);
printf("Enter burst time for sequences....:");
for(i=0;itq)
st[i]=st[i]-tq;
else
if(st[i]>=0)
{
xx=st[i];
st[i]=0;
}
sq=sq+xx;
tat[i]=sq;
}
if(n==count)
break;
}
for(i=0;i
Output :
enter the process name : aaa
enter the processing time : 4
enter the process name : bbb
enter the processing time : 3
enter the process name : ccc
enter the processing time : 2
enter the process name : ddd
enter the processing time : 5
enter the process name : eee
enter the processing time : 1
OUTPUT :
p_name p_time w_time
aaa 4 9
bbb 3 3
ccc 2 6
ddd 5 10
eee 1 11
total waiting time : 39
average waiting time : 7.8000





u could add the arrival time of process,i mean get that also as input adn process it..tat makes the pgm more complicated!!
ReplyDelete