欢迎来到天天文库
浏览记录
ID:61780795
大小:13.83 KB
页数:5页
时间:2021-03-20
《缺页中断统计代码.docx》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、__________________________________________________#includevoidPrint(intbc[],intblockCount){for(inti=0;i2、x){is_found=true;break;}}returnis_found;____________________________________________________________________________________________________}voidOptiomal(intpc[],intbc[],intpageCount,intblockCount){printf("×î¼ÑÖû»Ëã·¨");if(pageCount<=blockCount){printf("ȱҳ´3、ÎÊýΪ0");printf("ȱҳÂÊΪ");}else{intnoPage=0;inti,j,k;for(i=0;i4、ntblockIndex;;for(j=0;j=max){max=k;blockIndex=j;}}bc[blockIndex]=pc[i];}noPage++;}____________________________________________________________________________________________________}printf(5、"OPTȱҳ´ÎÊýΪ:%d",noPage);printf("OPTȱҳÂÊΪ:%.2f%%",(float)noPage/pageCount*100);}}intmain(){intpageCount,blockCount,i,pc[100];printf("ÊäÈëÒ³ÃæÊý");scanf("%d",&pageCount);printf("ÊäÈëÒ³Ãæ×ßÏò");for(i=0;i6、;intbc[100];printf("");Optiomal(pc,bc,pageCount,blockCount);return0;____________________________________________________________________________________________________}__________________________________________________
2、x){is_found=true;break;}}returnis_found;____________________________________________________________________________________________________}voidOptiomal(intpc[],intbc[],intpageCount,intblockCount){printf("×î¼ÑÖû»Ëã·¨");if(pageCount<=blockCount){printf("ȱҳ´
3、ÎÊýΪ0");printf("ȱҳÂÊΪ");}else{intnoPage=0;inti,j,k;for(i=0;i4、ntblockIndex;;for(j=0;j=max){max=k;blockIndex=j;}}bc[blockIndex]=pc[i];}noPage++;}____________________________________________________________________________________________________}printf(5、"OPTȱҳ´ÎÊýΪ:%d",noPage);printf("OPTȱҳÂÊΪ:%.2f%%",(float)noPage/pageCount*100);}}intmain(){intpageCount,blockCount,i,pc[100];printf("ÊäÈëÒ³ÃæÊý");scanf("%d",&pageCount);printf("ÊäÈëÒ³Ãæ×ßÏò");for(i=0;i6、;intbc[100];printf("");Optiomal(pc,bc,pageCount,blockCount);return0;____________________________________________________________________________________________________}__________________________________________________
4、ntblockIndex;;for(j=0;j=max){max=k;blockIndex=j;}}bc[blockIndex]=pc[i];}noPage++;}____________________________________________________________________________________________________}printf(
5、"OPTȱҳ´ÎÊýΪ:%d",noPage);printf("OPTȱҳÂÊΪ:%.2f%%",(float)noPage/pageCount*100);}}intmain(){intpageCount,blockCount,i,pc[100];printf("ÊäÈëÒ³ÃæÊý");scanf("%d",&pageCount);printf("ÊäÈëÒ³Ãæ×ßÏò");for(i=0;i6、;intbc[100];printf("");Optiomal(pc,bc,pageCount,blockCount);return0;____________________________________________________________________________________________________}__________________________________________________
6、;intbc[100];printf("");Optiomal(pc,bc,pageCount,blockCount);return0;____________________________________________________________________________________________________}__________________________________________________
此文档下载收益归作者所有