0% found this document useful (0 votes)
33 views2 pages

Osy PR 14 D

Uploaded by

Disha Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views2 pages

Osy PR 14 D

Uploaded by

Disha Agrawal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Disha Agrawal

Roll no: 05
Practical no: 14

Q1)Consider the processes P1, P2, P3, P4 given in the below table, arrives for
execution in the same order, with Arrival Time 0, and given Burst Time, Find
using the FCFS scheduling algorithm.
1. Turn Around Time for each process.
2. Waiting Time for each process.
3. Average Turn Around time.
4. Average waiting time.

#include<stdio.
h>
#include<conio
.h> int main() {
int n,bt[20],wt[20],tat[20],avwt=0,avtat=0,i,j;
printf("\nEnter Total Number of Processes(maximum
20):");
scanf("\n%d",&n);
printf("\n enter process burst timen");
for(i=0;i<n;i++)
{
printf("\nP[%d]:",i+1);
scanf("\n%d",&bt[i]);
}
wt[0]=0;
for(i=1;i<n;i++)
{
wt[i]=0;
for(j=0;j<i;j++)
wt[i]+=bt[j];
}
printf("\nProcess\t\tBurst Time\tWaiting Time\tTurnaround Time:");
for(i=0;i<n;i++)
{
tat[i]=bt[i]+wt[i];
avwt+=wt[i];
avtat+=tat[i];
printf("\nP[%d]\t\t%d\t\t%d\t\t%d",i+1,bt[i],wt[i],tat[i]);
}
avwt/=i;
avtat/=i;
printf("\n\nAverage Waitng Time: %d",avwt);
printf("\nAverageTurnaround Time: %d",avtat);
return 0;
}
Output:

You might also like