Tuesday , December 6 2016
Home / C / Program for Round Robbin (RR) scheduling technique in C

Program for Round Robbin (RR) scheduling technique in C

This is a program in C for Round Robbin scheduling technique used for scheduling program in round robbin fashion.

void main()

{

int pe[10],count=0,burst[10],timeQ,i,j,k=1,l,n,wait[10],turn[10];

float avgwait=0,avgturn=0;

clrscr();

printf(“Enter total number of process \n”);

scanf(“%d”,&n);

printf(“Enter time quantum for process”);

scanf(“%d”,&timeQ);


for(i=0;i

{

printf(“Enter Burst time of process %d : “,i+1);

scanf(“%d”,&burst[i]);

pe[i]=0;

wait[i]=0;

}


//Here calculation starts for Round Robbin scheduling technique

printf(“\n\n”);

for(j=0;j

{

for(i=1;i<=timeQ;i++)

{

if(pe[j]

{

printf(“Process P%d  %d\n”,j+1,k);

pe[j]++;

k++;

for(l=0;l

{

if(l!=j && pe[l]

wait[l]++;

}

}

else

break;

}

if(j==n-1)

j=-1;

for(l=0;l

{

if(pe[l]==burst[l])

{

count++;

}

}

if(count==n)

break;

else

count=0;

}

printf(“\n\n”);

for(l=0;l

{

turn[l]=wait[l]+burst[l];

avgwait+=wait[l];

avgturn+=turn[l];

printf(“Process %d Burst Time %d Waiting Time %d Turn Around Time %d \n”,l+1,burst[l],wait[l],turn[l]);


}
avgwait/=n;

avgturn/=n;

printf(“\n\n\nAverage Turn Around Time : %f  Average Waiting Time : %f”,avgturn,avgwait);

getch();


}


OUTPUT 


Tags: round robin scheduling program in c, program for round robbin scheduling in c.

Also See:   C program for priority scheduling

Check Also

Hide Mouse Pointer C Program

How to Hide a Mouse Pointer Program in C : This program will show and hide ...

One comment

  1. sorry but this it not completed

    for(j=0;j
    {
    ….
    }
    almost this pattern is have a ploblem
    but thx for the code

Leave a Reply

Your email address will not be published. Required fields are marked *

Preventing spam * Time limit is exhausted. Please reload the CAPTCHA.