All Programs are Written and Compiled in Dev C++. So, it may generate some error in case of other compilers and may need some modifications in program. Download Dev C++

Tuesday 28 October 2014

LRU Page Replacement Program

LRU Page Replacement Program

#include<iostream>
using namespace std;
int main()
{
int p[50],q[20],b[20],c2[20];
int c=0,k=0,c1,d,f,i,j,n,r,t;
cout<<"Enter no of pages:";
cin>>n;
cout<<"Enter the reference string:";
for(i=0;i<n;i++)
cin>>p[i];
cout<<"Enter no of frames:";
cin>>f;
q[k]=p[k];
cout<<"\n\t"<<q[k]<<endl;
c++;
k++;
for(i=1;i<n;i++)
    {
        c1=0;
        for(j=0;j<f;j++)
        {

Tuesday 21 October 2014

FIFO Page Replacement Program

 To Implement FIFO Page Replacement

#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,k,n,no,avail;
int a[50],frame[10],count=0;
cout<<"\n Enter The Number of Pages:";
cin>>n;
cout<<"\n Enter The Page Number :";
for(i=1;i<=n;i++)
        cin>>a[i];
cout<<"\n Enter The Number Of Frames :";
        cin>>no;
for(i=0;i<no;i++)
        frame[i]=-1;
j=0;
cout<<"\nRef_Str  \t Page_frames\n";
for(i=1;i<=n;i++)
{