操作系統(tǒng)內(nèi)存儲器空間的管理的實(shí)驗(yàn)報(bào)告_第1頁
操作系統(tǒng)內(nèi)存儲器空間的管理的實(shí)驗(yàn)報(bào)告_第2頁
操作系統(tǒng)內(nèi)存儲器空間的管理的實(shí)驗(yàn)報(bào)告_第3頁
操作系統(tǒng)內(nèi)存儲器空間的管理的實(shí)驗(yàn)報(bào)告_第4頁
操作系統(tǒng)內(nèi)存儲器空間的管理的實(shí)驗(yàn)報(bào)告_第5頁
已閱讀5頁,還剩10頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、安徽師范大學(xué) 學(xué)院實(shí)驗(yàn)報(bào)告專業(yè)名稱 軟件工程實(shí) 驗(yàn) 室 2#201實(shí)驗(yàn)課程 操作系統(tǒng)實(shí)驗(yàn)實(shí)驗(yàn)名稱 內(nèi)存儲器空間的管理姓 名 學(xué) 號 同組人員 實(shí)驗(yàn)日期 2013/6/7注:實(shí)驗(yàn)報(bào)告應(yīng)包含(實(shí)驗(yàn)?zāi)康模瑢?shí)驗(yàn)原理,主要儀器設(shè)備和材料,實(shí)驗(yàn)過程和步驟,實(shí)驗(yàn)原始數(shù)據(jù)記錄和處理,實(shí)驗(yàn)結(jié)果和分析,成績評定)等七項(xiàng)內(nèi)容。具體內(nèi)容可根據(jù)專業(yè)特點(diǎn)和實(shí)驗(yàn)性質(zhì)略作調(diào)整,頁面不夠可附頁。一、實(shí)驗(yàn)?zāi)康模阂粋€(gè)好的計(jì)算機(jī)系統(tǒng)不僅要有一個(gè)足夠容量的、存取速度高的、穩(wěn)定可靠的主存儲器,而且要能合理地分配和使用這些存儲空間。當(dāng)用戶提出申請存儲器空間時(shí),存儲管理必須根據(jù)申請者的要求,按一定的策略分析主存空間的使用情況,找出足夠的空閑

2、區(qū)域分配給申請者。當(dāng)作業(yè)撤離或主動(dòng)歸還主存資源時(shí),則存儲管理要收回作業(yè)占用的主存空間或歸還部分主存空間。主存的分配和回收的實(shí)現(xiàn)雖與主存儲器的管理方式有關(guān)的,通過本實(shí)驗(yàn)幫助學(xué)生理解在不同的存儲管理方式下應(yīng)怎樣實(shí)現(xiàn)主存空間的分配和回收。二、實(shí)驗(yàn)內(nèi)容利用高級語言,實(shí)現(xiàn)存儲分配算法,開發(fā)一個(gè)存儲管理的模擬程序,對內(nèi)存空間的管理和分配。內(nèi)存空間的管理可采用固定分區(qū)管理方式,可變分區(qū)管理方式,頁式存儲管理,段式存儲管理等方案。三、實(shí)驗(yàn)環(huán)境1 PC微機(jī)。2Windows 操作系統(tǒng)。3C/C+/VB開發(fā)集成環(huán)境。四、實(shí)驗(yàn)源程序代碼第一題:#include<iostream>#include<

3、string.h>using namespace std;#define m_STAY false;#define m_free true;static int i=6,m_s;int program100,pro_nub=4;int a100;typedef structbool state;int startplace;int thelength;string name;Th_table;bool checkisOK(Th_table *Trantables,Th_table s);void display(Th_table *Trantables);int numb(Th_tabl

4、e *T);int numb(Th_table *T)int sum=0;for(int j=0;j<i;j+)if(!Tj.state )sum+;return sum;void display(Th_table *Trantables)int m,p1=1,p2=1;for (m=0;m<i;m+)if (!Trantablesm.state)if(m!=0)cout<<"第"<<p1<<"個(gè)作業(yè)的信息:"<<endl;cout<<"第"<<p1&

5、lt;<"個(gè)"<<"作業(yè)的名字:"cout<<p1<<"作業(yè)"<<endl;cout<<"第"<<p1<<"個(gè)作業(yè)的開始地址:"cout<<Trantablesm.startplace<<"K"<<endl;cout<<"第"<<p1<<"個(gè)"<<"作業(yè)的

6、長度:"<<Trantablesm.thelength<<endl;cout<<"-"<<endl;p1+;elsecout<<"操作系統(tǒng)的信息:"<<endl;cout<<"操作系統(tǒng)的開始地址:"cout<<Trantablesm.startplace<<"K"<<endl;cout<<"操作系統(tǒng)的長度:"<<Trantablesm.thel

7、ength<<endl;cout<<"-"<<endl;elsecout<<"第"<<p2<<"個(gè)空閑區(qū)信息:"<<endl;cout<<"第"<<p2<<"個(gè)"<<"空閑區(qū)的名字:"<<p2<<"空閑區(qū)"<<endl;cout<<"第"<<p2&

8、lt;<"個(gè)空閑區(qū)的開始地址:"<<Trantablesm.startplace<<"K"<<endl;cout<<"第"<<p2<<"個(gè)空閑區(qū)的長度:"<<Trantablesm.thelength<<"K"<<endl;cout<<"-"<<endl;p2+;bool checkisOK(Th_table *Trantables,Th_

9、table s)int m;for( m=0;m<i;m+)if(Trantablesm.thelength>=s.thelength&&Trantablesm.state)m_s=m;return true;if (m=6) return false;int main()int mbs,g=1,j;char s='0'/t;Th_table Trantables100;T="操作系統(tǒng)"Trantables0.startplace=0;Trantables0.state=m_STAY;Trantabl

10、es0.thelength=5;program0=0;T="作業(yè)1"Trantables1.startplace=5;Trantables1.state=m_STAY;Trantables1.thelength=5;program1=1;T="作業(yè)3"Trantables2.startplace=10;Trantables2.state=m_STAY;Trantables2.thelength=4;program3=2;T="空閑區(qū)"Tranta

11、bles3.startplace=14;Trantables3.state=m_free;Trantables3.thelength=12;T="作業(yè)2"Trantables4.startplace=26;Trantables4.state=m_STAY;Trantables4.thelength=6;program2=4;T="空閑區(qū)"Trantables5.startplace=32;Trantables5.state=m_free;Trantables5.thelength=96; cou

12、t<<"ttt*"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt| 1 添 加 進(jìn) 程 |"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt| 2 結(jié) 束 |"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt| 3 顯 示 所

13、有 進(jìn) 程 |"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt| 4 要 求 進(jìn) 程 結(jié) 束 |"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt*"<<endl;cout<<"請輸入你要選擇的項(xiàng)目:"while(g)cin>>mbs;switch (mbs)case 1:cout<<&

14、quot;請輸入該進(jìn)程的長度"cin>>Trantablesi.thelength;cout<<"k!"<<endl;if (checkisOK(Trantables,Trantablesi)cout<<"進(jìn)程申請成功!"<<endl;programpro_nub=i;T="作業(yè)."Trantablesi.state=m_STAY;Trantablesi.startplace=Trantablesm_s.startplace;Trant

15、ablesm_s.startplace+=Trantablesi.thelength;Trantablesm_s.thelength-=Trantablesi.thelength;i+;pro_nub+;elsecout<<"不成功!重新輸入"<<endl;break;case 2: g=0;break;case 3:display(Trantables);break;case 4:cout<<"請輸入程序結(jié)束的次序:"<<endl;for( j=0;j<pro_nub;j+)cin>>a

16、j;for(j=0;j<pro_nub;j+)for(int g=0;g<i;g+)if(Trantablesg.state)if(Trantablesg.startplace=Trantablesaj.startplace+Trantablesai.thelength)Trantablesg.startplace-=Trantablesaj.thelength;Trantablesg.thelength+=Trantablesaj.thelength;Trantablesaj.state=m_free;Trantablesaj.thelength=0;cout<<&q

17、uot;刪除后內(nèi)存狀況為:"display(Trantables);if(Trantablesaj.startplace=Trantablesg.startplace+Trantablesg.thelength)Trantablesg.thelength+=Trantablesaj.thelength;Trantablesaj.state=m_free;Trantablesaj.thelength=0; break;return 0;第二題:#include<iostream>using namespace std;int pro88;int analysis(int L

18、,int R)if(proLR=0)proLR=1;return 1;else return 0;void display()int m,n;for(m=0;m<8;m+)for(n=0;n<8;n+)cout<<promn<<" "cout<<endl;void init()pro00=1;pro01=1;pro04=1;pro05=1;pro06=1;pro11=1;pro13=1;pro15=1;pro30=1;pro37=1;cout<<"初始化的結(jié)果是:"<<endl;di

19、splay();int main()bool h=1;int grom;int m_L,m_R,income;init();cout<<"ttt*"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt| 1 申 請 |"<<endl;cout<<"ttt| |"<<endl;cout<<"ttt| 2 退 出 |"<<endl;cout<<"ttt| |"<<endl;c

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論