Guest User

Untitled

a guest
Jul 25th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.35 KB | None | 0 0
  1.  
  2.  
  3. More
  4. 1 of 73
  5.  
  6. Fwd: week 1
  7. Inbox
  8. x
  9.  
  10. guna srujith reddy
  11. Attachments2:09 PM (8 minutes ago)
  12. to me
  13.  
  14. ---------- Forwarded message ----------
  15. From: guna srujith reddy <gunasrujithreddy53@gmail.com>
  16. Date: Wed, Jul 25, 2018 at 1:25 PM
  17. Subject: Fwd: week 1
  18. To: saikumarmalapathi35@gmail.com, malkapuramvamshi@gmail.com
  19.  
  20.  
  21.  
  22. ---------- Forwarded message ----------
  23. From: Aashritha Aash <aashritha123aash@gmail.com>
  24. Date: Wed, Jul 25, 2018 at 1:11 PM
  25. Subject: Fwd: week 1
  26. To: gunasrujithreddy53@gmail.com
  27.  
  28.  
  29.  
  30. ---------- Forwarded message ----------
  31. From: Sayona Sebastian <sayonamaria@gmail.com>
  32. Date: Wed, Jul 18, 2018 at 3:45 PM
  33. Subject: week 1
  34. To: Harshini venteru <harshiniv216@gmail.com>, namarishika@gmail.com, srathiba chowdary <srathibachowdary@gmail.com>, potlapally kundhana rao <potlapally.kundhanarao@gmail.com>, Aashritha Aash <aashritha123aash@gmail.com>
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42. 4 Attachments
  43.  
  44. Click here to Reply or Forward
  45. 0.14 GB (0%) of 15 GB used
  46. Manage
  47. Terms · Privacy · Program Policies
  48. Last account activity: 22 hours ago
  49. Details
  50.  
  51. #include<stdio.h>
  52.  
  53. int main()
  54. {
  55.  
  56. int count,j,n,time,remain,flag=0,time_quantum;
  57. int wait_time=0,turnaround_time=0,at[10],bt[10],rt[10];
  58. printf("Enter Total Process:\t ");
  59. scanf("%d",&n);
  60. remain=n;
  61. for(count=0;count<n;count++)
  62. {
  63. printf("Enter Arrival Time and Burst Time for Process Process Number %d :",count+1);
  64. scanf("%d",&at[count]);
  65. scanf("%d",&bt[count]);
  66. rt[count]=bt[count];
  67. }
  68. printf("Enter Time Quantum:\t");
  69. scanf("%d",&time_quantum);
  70. printf("\n\nProcess\t|Turnaround Time|Waiting Time\n\n");
  71. for(time=0,count=0;remain!=0;)
  72. {
  73. if(rt[count]<=time_quantum && rt[count]>0)
  74. {
  75. time+=rt[count];
  76. rt[count]=0;
  77. flag=1;
  78. }
  79. else if(rt[count]>0)
  80. {
  81. rt[count]-=time_quantum;
  82. time+=time_quantum;
  83. }
  84. if(rt[count]==0 && flag==1)
  85. {
  86. remain--;
  87. printf("P[%d]\t|\t%d\t|\t%d\n",count+1,time-at[count],time-at[count]-bt[count]);
  88. wait_time+=time-at[count]-bt[count];
  89. turnaround_time+=time-at[count];
  90. flag=0;
  91. }
  92. if(count==n-1)
  93. count=0;
  94. else if(at[count+1]<=time)
  95. count++;
  96. else
  97. count=0;
  98. }
  99. printf("\nAverage Waiting Time= %f\n",wait_time*1.0/n);
  100. printf("Avg Turnaround Time = %f",turnaround_time*1.0/n);
  101.  
  102. return 0;
  103. }
Add Comment
Please, Sign In to add comment