© 2012 Firstsoft Technologies (P) Limited. login
Hi 'Guest'
Home SiteMap Contact Us Disclaimer
enggedu
Quick Links
Easy Studies
« NS2  Projects »


C Program For Priority Scheduling Algorithm

C Program For Priority Scheduling Algorithm

//priority scheduling #include #include #include void main() { int n,b[10],w[10],i,j,h,t,tt; int stime[10],a[10],p[10]; float avg=0; clrscr(); printf("\n\tPRIORITY SCHEDULING ALGORITHM"); printf("\n\t*****************************************************\n"); printf("\nEnter howmany jobs:"); scanf("%d",&n); printf("\nEnter burst time & priority for corresponding job....\n"); for(i=1;i<=n;i++) { printf("\nProcess %d:",i); scanf("%d %d",&b[i],&p[i]); a[i]=i; } for(i=1;i<=n;i++) for(j=i;j<=n;j++) if(p[i]

SAMPLE INPUT AND OUTPUT:

Enter howmany jobs:3

Enter burst time & priority for corresponding job....

Process 1:5 2

Process 2:7 1

Process 3:6 3

        PRIORITY SCHEDULING ALGORITHM
        *****************************************************

Enter howmany jobs:3

Enter burst time & priority for corresponding job....

Process 1:5 2

Process 2:7 1

Process 3:6 3

process 3 waiting time is 0
Process 1 waiting time: 6
Process 2 waiting time: 11
total waiting time:17.000000

the average waiting time is:5.666667

Gaunt Chart
***************************************

        6▬▬▬▬▬▬5▬▬▬▬▬7▬▬▬▬▬▬▬
        06▬▬▬▬▬▬11▬▬▬▬▬▬▬▬▬▬▬

 

SLogix Student Projects

⇓ Student Projects ⇓
⇑ Student Projects ⇑
bottom