answersLogoWhite

0

#include<stdio.h>

#include<conio.h>

main()

{

int st[10],bt[10],wt[10],tat[10],n,tq;

int i,count=0,swt=0,stat=0,temp,sq=0;

float awt=0.0,atat=0.0;

clrscr();

printf("Enter number of processes:");

scanf("%d",&n);

printf("Enter burst time for sequences:");

for(i=0;i<n;i++)

{

scanf("%d",&bt[i]);

st[i]=bt[i];

}

printf("Enter time quantum:");

scanf("%d",&tq);

while(1)

{

for(i=0,count=0;i<n;i++)

{

temp=tq;

if(st[i]==0)

{

count++;

continue;

}

if(st[i]>tq)

st[i]=st[i]-tq;

else

if(st[i]>=0)

{

temp=st[i];

st[i]=0;

}

sq=sq+temp;

tat[i]=sq;

}

if(n==count)

break;

}

for(i=0;i<n;i++)

{

wt[i]=tat[i]-bt[i];

swt=swt+wt[i];

stat=stat+tat[i];

}

awt=(float)swt/n;

atat=(float)stat/n;

printf("Process_no Burst time Wait time Turn around time

");

for(i=0;i<n;i++)

printf("%d %d %d %d

",i+1,bt[i],wt[i],tat[i]);

printf("Avg wait time is %f

Avg turn around time is %f",awt,atat);

getch();

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

What are the disadvantages of RoundRobin Scheduling?

Pure round robin scheduling processes A, then B, then C, then starts at A again. (A, B, C might be tasks in an operating system context, or devices in a master/slave control network, or whatever.) That is, pure round robin scheduling doesn't acknowledge priorities, and does not allow out-of-order processing. Real-life systems typically use a mixture of algorithms that, together, allow for prioritized and out-of-order processing while, on the other hand, trying to prevent starvation of lower priority items.


Why in round robin new processes place at end of queue rather than at beginning?

in roundrobin scheduling each process is gven a fixed time to execute so whenever a new process arrives it is placed at the end of the queue,,,,,the advantage by doing this type of scheduling is response time will be gud...But the disadvantage waiting time is more


What is disk scheduling in operating system?

why we use disk scheduling in c ?


What has the author Don C Adams written?

Don C. Adams has written: 'Block scheduling' -- subject(s): Block scheduling (Education)


What has the author J C Thorpe written?

J. C. Thorpe has written: 'A comparison of vehicle scheduling methods'


What has the author Steven C Kleiner written?

Steven C. Kleiner has written: 'Distribution of a generic mission planning and scheduling toolkit for astronomical spacecraft' -- subject(s): Scheduling, Mission planning, Spaceborne astronomy, Launch vehicles


Is C plus plus preprocessor software?

Sometimes, it is. Some implementations compile C++ code into C code, and then compile the C code.


Which type of scheduling are part of the IBM Tivoli Storage Manager server?

A) client schedules B) migration schedules C) enterprise schedules D) Synchronized scheduling with IBM Tivoli Workload Scheduler


What is the efficiency of the C scan algorithm for disk scheduling?

The efficiency of the C-scan algorithm for disk scheduling is considered to be high. It is a variant of the scan algorithm that improves performance by reducing the seek time of the disk arm. The C-scan algorithm scans the disk in one direction only, which can lead to faster access times compared to other algorithms.


What is local scheduling and global scheduling?

i do no...............


Suction d and c cpt code?

wat is the code for SUCTION d and c


Discrete fourier transform of an image in c code?

i want c code for fourier transform?