Shishu

waiting time and bust time in operating system lab

Sep 19th, 2018
283
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.63 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. void main()
  4. {
  5.  
  6.     int bt[20], wt[20], tat[20], i, n;
  7.     float wtavg, tatavg;
  8.     printf ("Enter the no. of process: ");
  9.     scanf("%d",&n);
  10.     for(i=0; i<n; i++)
  11.     {
  12.         printf ("Enter burst time for processed %d:",i);
  13.         scanf ("%d", &bt[i]);
  14.     }
  15.  
  16.     //waiting time & TA time
  17.     wt[0]=0;
  18.     tat[0]=bt[0];
  19.  
  20.     for(i=1; i<n; i++)
  21.     {
  22.         wt[i]=tat[i-1];
  23.         tat[i]=bt[i]+wt[i];
  24.     }
  25.        printf("\t process \t Bust time \t waiting time \t turnarandT");
  26.     for(i=0; i<n; i++)
  27.     {
  28.         printf("\n\t p%d \t\t%d \t\t%d \t\t%d",i,bt[i],wt[i],tat[i]);
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment