Real vaqt tizimlarini yaratish texnologiyalari. Qisqacha nazariy ma’lumotlar



Yüklə 91,53 Kb.
səhifə2/2
tarix23.11.2022
ölçüsü91,53 Kb.
#70094
1   2
Real vaqt tizimlarini yaratish texnologiyalari

Laborotoriya qismi:
Real vaqt tizimlarida Round-Robin algoritmi yordamida o’rtacha kechikish va minimum bajarilish vaqtini aniqlash.

Jarayonlar navbati

Oniy vaqti

P1

53

P2

17

P3

68

P4

24

Vaqt bo`lagi=20 s

P1

P2

P3

P4

P1

P3

P4

P1

P3

P3

0 20 37 57 77 97 117 121 134 154 162

  1. P1 >> 53-20=33 >> 33-20=13

  2. P2 >> 17

  3. P3>> 68-20=48 >> 48-20=28 >> 28-20=8

  4. P4>>24-20=4

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

O’rtacha kutish vaqti = 292/4 = 73 milliseconds


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;
}

Yüklə 91,53 Kb.

Dostları ilə paylaş:
1   2




Verilənlər bazası müəlliflik hüququ ilə müdafiə olunur ©azkurs.org 2024
rəhbərliyinə müraciət

gir | qeydiyyatdan keç
    Ana səhifə


yükləyin