Resources » Articles/Knowledge Sharing » General

Fcfs scheduling program in c


Posted Date: 07-Nov-2009  Last Updated:   Category: General    
Author: Member Level: Silver    Points: 2






FCFS SCHEDULING

#include
int main()
{
int i,n,b[10],w[10],e[10];
float aw,ae;
aw=ae=0.0;
printf("Enter the number of jobs:");
scanf("%d",&n);
for(i=0;i {
printf("\n Enter the burst time for job %d:",i+1);
scanf("%d",&b[i]);
if(i==0)
{
w[0]=0;
e[0]=b[0];
}
else
{
w[i]=e[i-1];
e[i]=e[i-1]+b[i];
}
}
printf (“\n job \t Burst time \t Exec time \t Wt. time");
for(i=0;i {
printf("\n %d\t\t%d\t\t%d\t\t%d",i+1,b[i],e[i],w[i]);
aw+=w[i];
ae+=e[i];
}
aw=aw/n;
ae=ae/n;
printf("\n Average waiting time is :%f",aw);
printf("\n Average execution time is:%f",ae);
return(0);
}


Did you like this resource? Share it with your friends and show your love!




Responses to "Fcfs scheduling program in c"

No responses found. Be the first to respond...

Feedbacks      

Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Submit Article     Return to Article Index

    Awards & Gifts
    Active Members
    TodayLast 7 Daysmore...

    ISC Technologies, Kochi - India. Copyright © All Rights Reserved.