模拟分页式存储管理中硬件的地址转换和用先进先出调度算法处理中断
#include "stdlib.h"
#include "stdio.h"
#include "iostream.h"
#define TOTALPAGE 7 /* 作业实际所需的的页总数 */
#define SAVEBLOCKS 4 /* 分配给作业的主存块数 */
#define BLOCKSIZE 1024 /* 主存的每块大小 */
#include "math.h"
#include "stdio.h"
struct Cpageform
{int pagenumber, biaozh ,kuai ,xgbz ,cpwz; };
struct Cwork {char caoz;
int pagenumber,pageaddress;};
Cpageform pageform[]=
{
{0,1,5,0,0x11},
{1,1,8,0,0x12},
{2,1,9,0,0x13},
{3,1,1,0,0x21},
{4,0,0,0,0x22},
{5,0,0,0,0x23},
{6,0,0,0,0x121}
};
Cwork work[]=
{
{'+',0,0x70},
{'+',1,0x50},
{'*',2,0x15},
{'s',3,0x21},
{'f',0,0x56},
{'-',6,0x40},
{'m',4,0x53},
{'+',5,0x23},
{'s',1,0x37},
{'f',2,0x78},
{'+',4,0x01},
{'s',6,0x84} };
const int m=4;
int p[]={0,1,2,3};
void fifo1(int p[],int,int&,int);
void main()
{ int k=0;
int l;
int j=0;
int i;
for( i=0;i<12;i++)
{ l=work[i].pagenumber;
cout<< ;
l100: j=0;
while (l!=pageform[j].pagenumber&&j<7)
{j=j+1;}
if (pageform[j].biaozh!=1)
{
cout<<"interrupt:"<<" * ";
fifo1( p,l,k,j);
goto l100;
}
long int address;
address=1024*pageform[j].kuai;
address=address*work[i].pageaddress;
if (work[i].caoz=='s')
{
pageform[j].biaozh=1;
}
cout<<"pagenumber:";
cout<<"in:";
p[k]=l;
k=int(fmod((k+1),m));
pageform[pp].biaozh=0;
pageform[l].biaozh=1;
}
我这个不完全的程序,哪位大哥大姐帮忙改正下,顺便帮忙说下程序的运行思路,小弟不胜感激