QUOTE (madhuri1241 @ Jan 25 2009, 01:02 PM)

hiiiii
i want c program for round robin scheduling algorithm
the progarm must read
process name
arrivala time
slice timee
and must return
start time of each process
turn around time
average waiting timeeeplzzzzzzzzz
its very urgent
iam nt geting itttttt
plz
plz
plz
plz

#include<stdio.h>
#include<conio.h>
void main()
{
int n,q[50],max,i,j,t,d,c,r=0,f=0,wt[50],k;
clrscr();
printf("Enter the number of processors:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter the burst time for P%d:",i);
scanf("%d",&q[i]);
if(i==1)
{
f++;
max=q[1];
}
else if(max<q[i])
max=q[i];
r++;
}
printf("Enter the execution time for processors:");
scanf("%d",&t);
c=1;
for(c=1,i=n+1;c<=(max/t)*n;c++,i++)
{
if(q[c]>t)
q[i]=q[c]-t;
else
q[i]=0;
}
wt[1]=wt[2]=wt[3]=wt[4]=wt[5]=0;
for(r=1;max>=0;)
{
for(i=1;i<=n;i++)
{
if(q[r]>0)
{
if(r==1&&f==1)
wt[1]=0;
else
{
for(k=r;k>f;k--)
if(q[k-1]>=t)
wt[i]=wt[i]+t;
else
wt[i]=wt[i]+q[k-1];
}
if(r>=n)
f++;
}
else
f++;
r++;
}
max-=t;
}
for(i=1;i<=n;i++)
printf("%d\t",wt[i]);
getch();
}