#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char c[12];
int size=3,fpoint=0,top=0;
int frame[3],stack[3];
cout<<"enter your string:";
cin>>c;
int i,j,val,flag=0,temp,fault=0;
for(i=0;c[i]!='\0';i++)
{
val=c[i]-'0';
if(top!=size)
{
stack[top]=i;
frame[i]=val;
fpoint++;
top++;
fault++;
}
else
{
flag=0;
for(j=0;j<fpoint;j++)
{
if(frame[j]=val)
{
int z=0;
while(stack[z]!=j)
{
z++;
}
temp=stack[z];
for(int x=z;x<top-1;x++)
{
stack[x]=stack[x+1]
}
stack[top-1]=temp;
flag=1;
break;
}
}
if(flag!=1)
{ frame[stack[0]]=val;
temp=stack[0];
for(int x=0;x<top-1;x++)
{
stack[x]=stack[x+1]
}
stack[top-1]=temp;
fault++;
}
}
}
return 0;
}
Various Process Scheduling Algorithms:
#include<fstream>
using namespace std;
int main()
{
char c[12];
int size=3,fpoint=0,top=0;
int frame[3],stack[3];
cout<<"enter your string:";
cin>>c;
int i,j,val,flag=0,temp,fault=0;
for(i=0;c[i]!='\0';i++)
{
val=c[i]-'0';
if(top!=size)
{
stack[top]=i;
frame[i]=val;
fpoint++;
top++;
fault++;
}
else
{
flag=0;
for(j=0;j<fpoint;j++)
{
if(frame[j]=val)
{
int z=0;
while(stack[z]!=j)
{
z++;
}
temp=stack[z];
for(int x=z;x<top-1;x++)
{
stack[x]=stack[x+1]
}
stack[top-1]=temp;
flag=1;
break;
}
}
if(flag!=1)
{ frame[stack[0]]=val;
temp=stack[0];
for(int x=0;x<top-1;x++)
{
stack[x]=stack[x+1]
}
stack[top-1]=temp;
fault++;
}
}
}
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