#include<iostream>
#include<fstream>
using namespace std;
int main()
{
int n,at,bt;
char proc[200],file1[50];
fstream my;
cout<<"enter file name";
cin.getline(file1,50);
my.open(file1,ios::out);
cout<<"how many";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"enter process:";
cin>>proc;
cout<<"enter arrival time";
cin>>at;
cout<<"enter burst time;";
cin>>bt;
my<<proc<<endl<<at<<endl<<bt<<endl;
}
my.close();
fstream myf;
myf.open(file1,ios::in);
char p[200];
float arival;
float waiting=0;
float brust;
float totalw=0;
for(float i=0;i<n;i++)
{
waiting=waiting+(totalw-arival);
cout<<"watiit"<<waiting<<endl;
totalw=totalw+brust;
}
float t=1.00;
t = waiting/n;
cout<<"n is"<<n;
cout<<"average waiting time is"<<t;
return 0;
}
Various Process Scheduling Algorithms:
#include<fstream>
using namespace std;
int main()
{
int n,at,bt;
char proc[200],file1[50];
fstream my;
cout<<"enter file name";
cin.getline(file1,50);
my.open(file1,ios::out);
cout<<"how many";
cin>>n;
for(int i=0;i<n;i++)
{
cout<<"enter process:";
cin>>proc;
cout<<"enter arrival time";
cin>>at;
cout<<"enter burst time;";
cin>>bt;
my<<proc<<endl<<at<<endl<<bt<<endl;
}
my.close();
fstream myf;
myf.open(file1,ios::in);
char p[200];
float arival;
float waiting=0;
float brust;
float totalw=0;
for(float i=0;i<n;i++)
{
waiting=waiting+(totalw-arival);
cout<<"watiit"<<waiting<<endl;
totalw=totalw+brust;
}
float t=1.00;
t = waiting/n;
cout<<"n is"<<n;
cout<<"average waiting time is"<<t;
return 0;
}
Various Process Scheduling Algorithms:
- First come First served Scheduling Algorithm
- Non preemptive Shortest job first (SJF) scheduling Algorithm
- preemptive shortest job first (SJF) scheduling algorithm
- Non preemptive priority scheduling algorithm
- preemptive priority scheduling algorithm
- Roun Robin scheduling Algorithm
Various Page Replacement Algorithms:
- Page replacement using Least Recently Used (LRU) algorithm techneques.
- Page replacement using First come first served algorithm techniques.
Various Disk Head Movement Counting Algorithms:
- Count the disk head movement using first come first served (FCFS) algorithm
- head movement count using shortest seek job first (SSJF)
- head movement count using scan scheduling algorithm
- head movement count using c-scan scheduling algorithm
- head movement count using loop scheduling algorithm
- head movement count using c-loop scheduling alogrithm
No comments:
Post a Comment