計算機操作系統(tǒng)頁面置換源碼

上傳人:靚*** 文檔編號:24876298 上傳時間:2021-07-15 格式:DOCX 頁數(shù):4 大小:70.32KB
收藏 版權申訴 舉報 下載
計算機操作系統(tǒng)頁面置換源碼_第1頁
第1頁 / 共4頁
計算機操作系統(tǒng)頁面置換源碼_第2頁
第2頁 / 共4頁
計算機操作系統(tǒng)頁面置換源碼_第3頁
第3頁 / 共4頁

下載文檔到電腦,查找使用更方便

0 積分

下載資源

還剩頁未讀,繼續(xù)閱讀

資源描述:

《計算機操作系統(tǒng)頁面置換源碼》由會員分享,可在線閱讀,更多相關《計算機操作系統(tǒng)頁面置換源碼(4頁珍藏版)》請在裝配圖網(wǎng)上搜索。

1、v1.0可編輯可修改#include #include #include using namespacestd;#define MEM_SIZE 32#define RAM SIZE 16#define SWAP SIZE 32 static char ramRAM SIZE; static char SwapSWAP SIZE map M;struct page item ata = i;end_list = &itemi;resent) struct test_item * prev = first_list;struct test item * cur = first list-next

2、; while (cur != NULL)if (cur-data = laddr)prev-next = cur-next;cur-next = NULL;end_list-next = cur;end_list = cur;break;prev = cur;cur = cur-next;return page_tableladdr.ram_addr;odified) am_addr;Swappage_tablepage.swap_addr = data;page_tablepage.present = falseam_addr;page_tableladdr.ram_addr = padd

3、r;rampaddr = Swappage_tableladdr.swap_addr;page_tableladdr.modified = falsepage_tableladdr.present = true;page_tableladdr.access = 1;return paddr;int mem read(int addr, char *buf)if (addr MEM_SIZE)return -1;int paddr = mem access(addr);*buf = rampaddr;odified = true ;return 0;void mem_init( void )4w

4、ap_addr = i;page_tablei.present = false page_tablei.modified = falseam_addr = i;page_tablei.present = true;page_tablei.access = 0;void mem_state( void )printf( ram state:t );for ( int i = 0; i RAM_SIZE; i+) printf( %d , rami);printf( nswap state:t );for (int i = 0; i next;printf( access record: n );

5、while (cur != NULL)printf( %d , cur-data);prev = cur;cur = cur-next;void mem_test( void )printf(031為地址,在其中依次寫入031,則前16個將會被置換n);int test10 = 1,3, 5, 9, 6, 7, 19, 18, 31,0 ;for (int i = 0; i 32; i+)mem_write(i, i);mem_state();history_show();printf( n訪問22號單元,22f鏈表末段n );mem_write(22, 22);history_show();printf( n 訪問 11 單元,11 f鏈表末段,16-replace:n );mem_write(11, 11);history_show();int main( int argc, const char *argv口)mem_init();init_test_list();mem_test();system( pause);return 0;

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

相關資源

更多
正為您匹配相似的精品文檔
關于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!