實(shí)驗(yàn)三虛擬內(nèi)存管理_第1頁
實(shí)驗(yàn)三虛擬內(nèi)存管理_第2頁
實(shí)驗(yàn)三虛擬內(nèi)存管理_第3頁
實(shí)驗(yàn)三虛擬內(nèi)存管理_第4頁
實(shí)驗(yàn)三虛擬內(nèi)存管理_第5頁
已閱讀5頁,還剩13頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡介

專6( 日1實(shí)驗(yàn))要系統(tǒng)平臺求WindowsXP)數(shù)組語法:無返回值數(shù)組(數(shù)值數(shù)組變量#include#include#include#include#defineKusingnamespaceintvoid{inti,for(i=0;i<K;for(j=0;j<K;return}void{inti,for(i=0;i<K;i++)for(j=0;j<K;return;}int{SYSTEMTIMEreturn}intmain(intargc,char{intintt1,t1=for(i=0;i<10;i++)t2=cout<<"\n按行耗費(fèi)時間為:"<<t2-t1<<"ms"<<endl; t1=t2=cout<<"按列耗費(fèi)時間為:"<<t2-t1<<"ms"<<endl;return}linux#include<iostream>#include<stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/time.h>#defineK4096usingnamespacestd;inta[K][K];void{inti,for(i=0;i<K;for(j=0;j<K;j++)return}void{inti,for(i=0;i<K;for(j=0;j<K;j++)return}int{structtimevaltv;structtimezonetz;returntv.tv_sec*1000+}intmain(intargc,char{intintt1,t1=for(i=0;i<10;i++)t2=cout<<"*********數(shù)組cout<<"\n按行耗費(fèi)時間為:"<<t2-t1<<"ms"<<endl; t1=gettime();t2=cout<<"按列耗費(fèi)時間為:"<<t2-t1<<"ms"<<endl;return0;}Windows內(nèi)存管理機(jī)制了解清楚,有./C++內(nèi)存函RAM頁面后,會將這個2windows)輸入頁 頁 是否 置缺頁標(biāo)記flag調(diào)入 頁先前先前的頁面置頁面訪問 置頁面訪問是2.最近最久沒使用否前面 過頁面字#include#definen#definemvoid{char elseflag='{ 的}}:\n");{printf("\n");}#include"stdio.h"#definen20#definem5void{intym[n],i,j,q,mem[m]={-1,-1,-1,-1,-1},table[m][n];charflag,f[n]; elseflag=''; }:\n");printf(“%s”,“---”); }}}通過本次實(shí)驗(yàn),我明白如果一個經(jīng)常使用的頁面被置換出去,很有可能很快3(實(shí)驗(yàn)要(求WindowsXP)#include<stdio.h>#include<stdlib.h>//操作系統(tǒng)首次合并算法內(nèi)存實(shí)現(xiàn) 函數(shù) g_MemoryAllocLen=10;typedefstructdouble_link{structdouble_link*front;structdouble_link*rear;intsize;int //0空閑1 doublelink_ST*Init_doublelinklist(lpdoublelink_ST {head= head->front=NULL;head->rear=head->size=head->state=1;returnhead;}voidCreatedoublelist(lpdoublelink_SThead,intspace[]){ p=for(inti=0;i<g_MemoryAllocLen{ s=(lpdoublelink_ST)malloc(sizeof(doublelink_ST)); =*(space+i);s->state=s->rear=NULL;s->front=NULL;p->rear=s;s->front=p;p=s;}}intself_malloc(lpdoublelink_SThead,int {intce=0;lpdoublelink_STp=head; {p->state=1;returnce;}{p->size=p->size-lpdoublelink_STnewspace=(lpdoublelink_ST)malloc(sizeof(doublelink_ST));newspace->state=1;newspace->size=newspace->front=p->front; p->front->rear=newspace;newspace->rear=p;p->front=newspace;g_MemoryAllocLen+=1; }}函數(shù)名稱voidself_ ce) lpdoublelink_STp=head;for(inti=0;i< { }if(1==p->state {p->front->size+=p->size;p->front->rear=p->rear;p->rear->front=p->front;p=g_MemoryAllocLen-=1;}{p->front->rear=p->rear;p->rear->front=p->front;g_MemoryAllocLen-=1;p=}{p->rear->size+=p->front->size+p->size;p->front->front->rear=p->rear;p->rear->front=p->front->front;g_MemoryAllocLen-=2;p->front=NULL;p=}{}{

p->state=1;}}}函數(shù)名稱voidprint_memory(lpdoublelink_ST p,intsize){intfor(i=0;i<{p=p-printf("printf("序列:%3d分配空間 }}int{ head,p allallo

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論