PAGING PROGRAM IN C++
THIS IS PAGING CODING IN C++ THAT HELP IN CODING AS WELL AS IN LEARNING
PAGING N C++:
#include<iostream>
using namespace std
int main()
{
int MAX=100;
int page[MAX],i,n,f,ps,off,pno;
system("cls")
cout<<"\nEnter the no of pages in memory"<<endl;
cin>>n;
cout<<"\nEnter page size"<<endl;
cin>>ps;
cout<<"\nEnter no of frames"<<endl;
cin>>f;
for(i=0;i<n;i++)
page[i]=-1;
cout<<"\nEnter the page table\n"<<endl;
cout<<"Enter frame no as -1 if that page is not present in any frame"<<endl;
cout<<"\npageno\tframeno\n-------\t-------";
for(i=0;i<n;i++)
{
cout<<"\n\n this \t\t"<<i<<endl;
cin>>page[i];
}
cout<<"\n\nEnter the logical address(i.e,page no & offset):";
cin>>pno>>off;
if(page[pno]==-1)
cout<<"\n\nThe required page is not available in any of frames"<<endl;
else
cout<<"\n\nPhysical address(i.e,frame no & offset):"<<page[pno]<<off);
return 1;
system("pause");
}
PAGING N C++:
#include<iostream>
using namespace std
int main()
{
int MAX=100;
int page[MAX],i,n,f,ps,off,pno;
system("cls")
cout<<"\nEnter the no of pages in memory"<<endl;
cin>>n;
cout<<"\nEnter page size"<<endl;
cin>>ps;
cout<<"\nEnter no of frames"<<endl;
cin>>f;
for(i=0;i<n;i++)
page[i]=-1;
cout<<"\nEnter the page table\n"<<endl;
cout<<"Enter frame no as -1 if that page is not present in any frame"<<endl;
cout<<"\npageno\tframeno\n-------\t-------";
for(i=0;i<n;i++)
{
cout<<"\n\n this \t\t"<<i<<endl;
cin>>page[i];
}
cout<<"\n\nEnter the logical address(i.e,page no & offset):";
cin>>pno>>off;
if(page[pno]==-1)
cout<<"\n\nThe required page is not available in any of frames"<<endl;
else
cout<<"\n\nPhysical address(i.e,frame no & offset):"<<page[pno]<<off);
return 1;
system("pause");
}
Very good ! This is very helpful . Thanks for sharing ...
ReplyDeleteThnx you
ReplyDeleteGood post with useful information. Thanks for sharing.
ReplyDeletethanku.........
DeleteGud one
ReplyDeletethanku..........
Deletegood one. nice post shared. go on and on. welcome to blogging world. hope to hear more from you..
ReplyDeletethank you so much for motivating me
Deletethanks
ReplyDelete