Kutish vaqti ( KV ) = Aylanish vaqti(AV) – Oniy vaqt ( OT )
->
Kutish vaqti P1 = 134-53 = 81 ms
Kutish vaqti P2 = 37-17 = 20 ms
Kutish vaqti P3 = 162-68 = 94 ms
Kutish vaqti P4 = 121-24 = 97 ms
Umumiy kutish vaqti = 81+20+94+97 = 292 ms
Tugash vaqti P1 = 134ms
Tugash vaqti P2 = 37 ms
Tugash vaqti P3 = 162 ms
Tugash vaqti P4 = 121 ms
Umumiy tugash vaqti UTV = 134+037+162+121= 454 ms
Bundan,
Oʻrtacha tugash vaqti = 454/4= 113.5 ms .
Robin-Roundi algoritmi dasturi.
#include using namespace std; int main(){ int i,j,k=0,p=0,q,temp,s=0,idle=0,done=0; float sum=0; //taking input cout<<"Please enter the number of proces : "; cin>>p; int a[p][4]; int b[p][5]; cout<<"Please enter the Time Quantum : "; cin>>q; cout<<"\n\nProcess\tArrival\tBurst\n-------\t-------\t-----\n"; for(i=0;i
for(j=0;j<3;j++){ cin>>a[i][j]; } a[i][3]=a[i][2];//storing total time of each process to another cell } cout<<"\n\nTime-Line is as follows (Verticle View)....\n\n"; i=a[0][1]; while(done!=p){ if(k==p) k=0; if(a[k][1]<=i){ if(a[k][2]!=0){ if(a[k][2]>=q){ printf("%5d-----------\n |p-%-4d|\n",i,a[k][0]); a[k][2]-=q; i+=q; } else{ printf("%5d-----------\n |p-%-4d|\n",i,a[k][0]); i+=a[k][2]; a[k][2]=0; } if(a[k][2]==0){ b[s][0]=a[k][0]; b[s][1]=a[k][1]; b[s][2]=i; b[s][3]=a[k][3]; b[s][4]=((i-a[k][1])-a[k][3]); sum+=((i-a[k][1])-a[k][3]); s++; done++; } idle=0; } k++; } else{ if(idle==0){ idle=1; k=0; } else if(idle==1){ printf("%5d-----------\n |Idle |\n",i); idle=2; i++; } else i++; } } printf("%5d-----------\n",i); cout< cout<<"Table of processes with completion record as they were completed\n\n"; cout<<"\n\nProcess\tArrival\tFinish\tTotal\tWait\n------------------------------------\n"; for(i=0;i cout< cout<<"\n\nAvg. Wait time = "< cout<<"\nProgrammed by : .\n\n"; //system("pause"); return 0; }