資源描述:
《linux操作系統(tǒng)實(shí)驗(yàn)報(bào)告 存儲管理試驗(yàn)》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在應(yīng)用文檔-天天文庫。
1、電子信息學(xué)院實(shí)驗(yàn)報(bào)告書課程名:《Linux操作系統(tǒng)實(shí)驗(yàn)》題目:實(shí)驗(yàn)三存儲管理試驗(yàn)實(shí)驗(yàn)類別【驗(yàn)證】班級:BX0907學(xué)號:09姓名:吳沛儒評語:實(shí)驗(yàn)態(tài)度:認(rèn)真()一般()差()實(shí)驗(yàn)結(jié)果:正確()部分正確()錯(cuò)()實(shí)驗(yàn)理論:掌握()熟悉()了解()不懂()操作技能:強(qiáng)()一般()差()實(shí)驗(yàn)報(bào)告:好()一般()差()成績:指導(dǎo)教師:胡靜批閱時(shí)間:年月日成績:指導(dǎo)教師:寧建紅批閱時(shí)間:年月日《Linux操作系統(tǒng)》實(shí)驗(yàn)報(bào)告-9-1、實(shí)驗(yàn)內(nèi)容或題目(1)模擬初始內(nèi)存頁面分配(數(shù)組、結(jié)構(gòu)體均可)(2)實(shí)現(xiàn)Buddyheap算法(3)通過鍵盤輸入隨機(jī)產(chǎn)生申請和釋放操作·請求:r8代表申請8個(gè)頁面?!め尫牛篺
2、4代表釋放4個(gè)頁面。(4)每個(gè)申請或釋放操作,都在屏幕上顯示操作前與操作后的內(nèi)存分配的對比圖。(5)實(shí)驗(yàn)假設(shè)申請和釋放的頁數(shù)都是2的整次冪。(1)建立工作集頁面模型。(2)利用隨機(jī)函數(shù)動態(tài)生成進(jìn)程訪問頁面的序列號。(3)實(shí)現(xiàn)FIFO頁面淘汰算法。(4)實(shí)現(xiàn)頁故障率反饋模型。2、實(shí)驗(yàn)?zāi)康呐c要求①(1)用C語言是實(shí)現(xiàn)模擬Linux系統(tǒng)中連續(xù)內(nèi)存分配用到的伙伴對算法。(2)通過鏈表的形式輸出在內(nèi)存申請和釋放過程中內(nèi)存狀態(tài)的對比圖。②(1)了解工作集模型的原理及其特點(diǎn)。(2)實(shí)現(xiàn)頁故障率反饋模型。3、實(shí)驗(yàn)步驟與源程序1.Buddyheap算法模擬源程序;《Linux操作系統(tǒng)》實(shí)驗(yàn)報(bào)告-9-#incl
3、ude#includetypedefstructblock{intsize;intstart;intloc;structblock*next;structblock*prior;}block;《Linux操作系統(tǒng)》實(shí)驗(yàn)報(bào)告-9-intmaxsize=512;block*note;block*id[10];voidprintmem(){inti;for(i=9;i>=0;i--){printf("%d->",i);block*temp=(structblock*)malloc(sizeof(structblock));temp=id[i]->next;wh
4、ile(temp!=NULL){printf("%d(%s)(%d)->",temp->size,temp->loc==1?"占用":"空閑",temp->start);temp=temp->next;}printf("");}}voidinit(){inti;for(i=0;i<9;i++){id[i]=(structblock*)malloc(sizeof(structblock));id[i]->prior=id[i];id[i]->next=NULL;}note=(structblock*)malloc(sizeof(structblock));note->size=maxsiz
5、e;note->start=0;note->loc=0;note->next=NULL;id[9]=(structblock*)malloc(sizeof(structblock));id[9]->next=note;id[9]->prior=id[9];note->prior=id[9];printmem();}intpower(intx,inty){intk=0,tmp=1;for(;k6、count++;}returncount;}intsplit(inttempId){block*pend=(structblock*)malloc(sizeof(structblock));block*cend=(structblock*)malloc(sizeof(structblock));block*newf=(structblock*)malloc(sizeof(structblock));block*newu=(structblock*)malloc(sizeof(structblock));pend=id[tempId]->next;intflag=0,isFirst=0;《Li
7、nux操作系統(tǒng)》實(shí)驗(yàn)報(bào)告-9-while(pend!=NULL){if(pend->loc==0){if(isFirst==0){id[tempId]->next=pend->next;}else{pend->prior->next=pend->next;}intsize=(pend->size)/2;intstart=pend->start;newu->size=size;newu->start=start