Operating Systems
Words: 275
Pages: 1
62
62
Download//Program for the SRTN Implementation
#include<stdio.h>int main(){ int At[10],Bt[29],Ct[8],Dt[4], end time, e ,the least; int rem=0,e ,time, summation_waitingtime=0,summation_turn_around_time=0; printf(“Write the Number of the Processes : “); scanf(“%d”,&n); for(a=0;a<n;a++) { printf(“Write the Arrival time Proc%d : “,a+1); scanf(“%d”,&At[a]); printf(“write the burst time for the processes Proc%d : “,a+1); scanf(“%d”,&Bt[a]); At[a]=bt[a]; } printf(“nnProct| The Processes Turnaround Time| the Process Waiting Timenn”); Dt[a]=0; for(time given =0;remain!=n;time++) { least=4; for(a=0;a<e;a++) { if(at[a]<=time given && Dt[a]<Dt[leastt] && Dt[a]>0) { least=a; } } Dt[least]–; if(Dt[least]==0) { remain++; endTime=time+1; printf(“nP[%d]t|t%dt|t%d”,leastt+1,the end_time-Dt[least],the end_time-bt[least]-at[least]); summation_waiting time+=end_time-Bt[least]-At[least]; summation_turn_around+=end_time-at[least]; } } printf(“nn The Avg_waiting_time = %fn”,summation_waiting time*1.0/n); printf(“The Avg Turn_Around_time = %f”,summation_turn_around*1.0/4); return 0;}
Subscribe and get the full version of the document name
Use our writing tools and essay examples to get your paper started AND finished.