Dipu Os
Dipu Os
INSTITUTE OF TECHNOLGY
Theory:
Basic Terminologies:
wt[0] = 0;
cout<<" Arival time " <<" Burst time " << " Waiting time "<< " Completion time " <<" Turn
around time "<< endl;
}
DIPENDRA JHA (IT-1)
(0035007721)
cout<< " Average waiting time = "<<tot_wt/n<< endl;
int main()
avgtime(at, n, bt);
return 0;
OUTPUT
*a = *b;
*b = temp;
swap(mat[k][j], mat[k][j+1]);
temp = mat[3][i-1];
val = j;
swap(mat[k][val], mat[k][i]);
int main() {
arrangeArrival(num, mat);
completionTime(num, mat);
cout<<"\t"<<mat[0][i]<<"\t\t"<<mat[1][i]<<"\t\t"<<mat[2][i]<<"\t\t"<<mat[3][i]<<"\t\t"<<mat[4][i]<<"\t\t
"<<mat[5][i]<<"\n";
average(num,mat);
OUTPUT
CODE :
#include <bits/stdc++.h>
struct Process {
int pid;
int bt;
int art;
};
int rt[n];
rt[i] = proc[i].bt;
while (complete != n) {
minm = rt[j];
shortest = j;
check = true;
}
DIPENDRA JHA (IT-1)
(0035007721)
if (check == false) {
t++;
continue;
rt[shortest]--;
minm = rt[shortest];
if (minm == 0)
minm = INT_MAX;
if (rt[shortest] == 0) {
complete++;
check = false;
finish_time = t + 1;
if (wt[shortest] <0)wt[shortest] = 0;
} t++;
findWaitingTime(proc, n, wt);
<<"Arival time\t"
int main()
findavgTime(proc, n);
return 0;
OUTPUT
int main()
int x[10];
int waiting[10],turnaround[10],completion[10];
int i,j,smallest,count=0,time,n = 4;
double avg=0,tt=0,end;
for(i=0;i<n;i++)
x[i]=b[i];
pr[9]=-1;
for(time=0;count!=n;time++)
smallest=9;
for(i=0;i<n;i++)
smallest=i;
b[smallest]=-1;
count++;
end=time+1;
completion[smallest] = end;
for(i=0;i<n;i++)
cout<<"
p"<<i+1<<"\t\t"<<x[i]<<"\t\t"<<a[i]<<"\t\t"<<waiting[i]<<"\t\t"<<turnaround[i]<<"\t\t"<<completio
n[i]<<"\t\t"<<pr[i]<<endl;
tt = tt + turnaround[i];
OUTPUT
int main()
b[] = { 5, 3, 2, 1},
x[10];
int waiting[10],turnaround[10],completion[10];
int i,j,smallest,count=0,time,n = 4;
double avg=0,tt=0,end;
x[i]=b[i];
p[9]=-1;
smallest=9;
smallest=i;
b[smallest]--;
count++;
end=time+1;
completion[smallest] = end;
cout<<"\tp"<<i+1<<"\t\t"<<x[i]<<"\t\t"<<a[i]<<"\t\t"<<waiting[i]<<"\t\t"<<turnaround[i]<<"\t\t"<<c
ompletion[i]<<"\t\t"<<p[i]<<endl;
tt = tt + turnaround[i];
OUTPUT