Round-robin CPU scheduling Program Algorithm in C

Definition : The term round-robin describes correspondence to a single address authored or signed by numerous individuals.

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

Related Links :

2 comments:

  1. 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
  2. This is not the complete code for RR algorithm.

    ReplyDelete


If you face any Problem in viewing code such as Incomplete "For Loops" or "Incorrect greater than or smaller" than equal to signs then please collect from My Web Site CLICK HERE


More Useful Topics...

 

History Of C..

In the beginning was Charles Babbage and his Analytical Engine, a machine
he built in 1822 that could be programmed to carry out different computations.
Move forward more than 100 years, where the U.S. government in
1942 used concepts from Babbage’s engine to create the ENIAC, the first
modern computer.
Meanwhile, over at the AT&T Bell Labs, in 1972 Dennis Ritchie was working
with two languages: B (for Bell) and BCPL (Basic Combined Programming
Language). Inspired by Pascal, Mr. Ritchie developed the C programming
language.

My 1st Program...


#include
#include
void main ()
{
clrscr ();
printf ("\n\n\n\n");
printf ("\t\t\t*******Pankaj *******\n");
printf ("\t\t\t********************************\n");
printf ("\t\t\t\"Life is Good...\"\n");
printf ("\t\t\t********************************");
getch ();
}

Next Step...


#include
#include

void main ()
{
clrscr ();
printf ("\n\n\n\n\n\n\n\n");
printf ("\t\t\t --------------------------- \n\n");

printf ("\t\t\t | IGCT, Info Computers, INDIA | \n\n");
printf ("\t\t\t --------------------------- ");

getch ();

}

Hits!!!