七章存儲(chǔ)器管理_第1頁(yè)
七章存儲(chǔ)器管理_第2頁(yè)
七章存儲(chǔ)器管理_第3頁(yè)
七章存儲(chǔ)器管理_第4頁(yè)
七章存儲(chǔ)器管理_第5頁(yè)
已閱讀5頁(yè),還剩23頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、第七講第七講 存儲(chǔ)器管理存儲(chǔ)器管理中國(guó)科學(xué)技術(shù)大學(xué)計(jì)算機(jī)系中國(guó)科學(xué)技術(shù)大學(xué)計(jì)算機(jī)系 陳香蘭陳香蘭2013fall內(nèi)容提要內(nèi)容提要v存儲(chǔ)器的層次結(jié)構(gòu)v程序執(zhí)行的基礎(chǔ)知識(shí)、程序的裝入和鏈接v連續(xù)分配存儲(chǔ)管理方式v分頁(yè)存儲(chǔ)管理方式v分段存儲(chǔ)管理v段頁(yè)式存儲(chǔ)管理存儲(chǔ)器的層次結(jié)構(gòu)存儲(chǔ)器的層次結(jié)構(gòu)v存儲(chǔ)器是計(jì)算機(jī)系統(tǒng)的重要組成部分容量、價(jià)格和速度之間的矛盾內(nèi)存、外存;易失性和永久性內(nèi)存,是稀缺資源v在現(xiàn)代計(jì)算機(jī)系統(tǒng)中,存儲(chǔ)通常采用層次結(jié)構(gòu)來組織多級(jí)存儲(chǔ)器結(jié)構(gòu)主存與寄存器高速緩存和磁盤緩存多級(jí)存儲(chǔ)器結(jié)構(gòu)多級(jí)存儲(chǔ)器結(jié)構(gòu)vstorage systems in a computer system can be o

2、rganized in a hierarchyspeed, access timecost per bitvolatility主存主存 vs. 寄存器寄存器vsame: access directly for cpuregister namememory addressvdifferent: access speedregister, one cycle of the cpu clockmemory, many cycles (2 or more)vdisadvantage: cpu needs to stall frequently & this is intolerablevrem

3、edycache高級(jí)緩沖技術(shù)高級(jí)緩沖技術(shù)cachingvcachingcopying information into faster storage systemwhen accessing, first check in the cache, iflin: use it directlylnot in: get from upper storage system, and leave a copy in the cachevusing of cachingregisters provide a high-speed cache for main memoryinstruction cache

4、 & data cachemain memory can be viewed as a fast cache for secondary storagemagnetic disks 磁盤磁盤v transfer time 傳輸時(shí)間tt data size * transfer ratetransfer rate (n m/s)-1 ( n byte/us )-1 1/n us/bytev positioning time 定位時(shí)間seek time 尋道ltsrotational latency 旋轉(zhuǎn)延遲ltrtp ts +tr m msv tt vs. tpplease store

5、data closely 內(nèi)容提要內(nèi)容提要v存儲(chǔ)器的層次結(jié)構(gòu)v程序執(zhí)行的基礎(chǔ)知識(shí)、程序的裝入和鏈接v連續(xù)分配存儲(chǔ)管理方式v分頁(yè)存儲(chǔ)管理方式v分段存儲(chǔ)管理v段頁(yè)式存儲(chǔ)管理程序執(zhí)行的基礎(chǔ)知識(shí)程序執(zhí)行的基礎(chǔ)知識(shí)vvon neumann architecture 馮諾依曼體系結(jié)構(gòu)(圖)program must be brought into memorymain memory is usually too smallvprocessprogram must be placed within a process for it to be executed作業(yè)池user programslwhere to

6、 place the programlseveral steps(圖)地址的類型地址的類型vabsolute address 絕對(duì)地址address seen by the memory unitphysical address 物理地址vrelative address 相對(duì)地址linear address 線性地址vlogical address 邏輯地址generated by the cpuvirtual address 虛擬地址vwhen can the absolute address can be decided?address binding 地址的綁定地址的綁定address

7、 binding 地址綁定地址綁定, the binding of instructions and data to memory, 可以在三種三種時(shí)刻進(jìn)行v compile time if memory location known a priori, absolute code can be generated; must recompile code if starting location changes.v load time must generate relocatable code if memory location is not known at compile time.

8、v execution time binding delayed until run time if the process can be moved during its execution from one memory segment to another. need hardware support for address maps (e.g., base and limit registers)邏輯地址空間和物理地址空間邏輯地址空間和物理地址空間v logical address space 邏輯地址空間 the set of all logical addresses genera

9、ted by a programv physical address space 物理地址空間 the set of all physical addresses corresponding to theses logical addresses v logical = physical compile-time & load-time address-bindingv logical (virtual) != physical addresses execution-time address-binding mmu (hardware device)memory-management

10、 unit (mmu)v hardware device, 邏輯地址 物理地址v relocation register 重定位寄存器 added to every address generated by a user process at the time it is sent to memory e.g. ms-dos on 80 x86v user program deals with logical addresses, it never sees the real physical addresses.是否需要將進(jìn)程的所有代碼和數(shù)據(jù)一次性裝入?是否需要將進(jìn)程的所有代碼和數(shù)據(jù)一次性裝

11、入?vshall we put the entire program & data of a process in physical memory before the process can be executed?vfor better memory space utilizationdynamic loadingdynamic linkingoverlaysswapping程序的裝入程序的裝入v絕對(duì)裝入方式v可重定位裝入方式v動(dòng)態(tài)運(yùn)行時(shí)裝入方式絕對(duì)裝入方式絕對(duì)裝入方式v編譯時(shí),產(chǎn)生absolute code,即使用絕對(duì)地址的代碼v裝入時(shí),必須裝入到指定的地址v無需對(duì)程序和數(shù)據(jù)的地

12、址進(jìn)行修改v適用于單道系統(tǒng)可重定位裝入方式可重定位裝入方式v大多數(shù)情況下,不能預(yù)知裝入地址,只能在裝入時(shí)確定v編譯時(shí),產(chǎn)生可重定位代碼,即使用相對(duì)地址的代碼v裝入時(shí),必須重定位通常把在裝入時(shí)對(duì)目標(biāo)程序中指令和數(shù)據(jù)的修改過程稱為重定位。v由于地址變換是在裝入時(shí)一次性完成的,以后不再改變,故稱為靜態(tài)重定位v可用于多道系統(tǒng)動(dòng)態(tài)運(yùn)行時(shí)重定位動(dòng)態(tài)運(yùn)行時(shí)重定位v有時(shí)候,程序會(huì)在內(nèi)存中移動(dòng)位置例如對(duì)換v需要能支持在運(yùn)行過程中動(dòng)態(tài)改變程序在內(nèi)存中的位置v方法:推遲重定位時(shí)機(jī)即從相對(duì)地址到絕對(duì)地址的轉(zhuǎn)換推遲到程序真正執(zhí)行時(shí)才進(jìn)行v因此,裝入內(nèi)存中的代碼和數(shù)據(jù)的地址仍然是相對(duì)地址v需要重定位寄存器的支持動(dòng)態(tài)運(yùn)行時(shí)

13、裝入方式動(dòng)態(tài)運(yùn)行時(shí)裝入方式v根據(jù)程序運(yùn)行的局部性,讓程序及其數(shù)據(jù)在需要時(shí)才被裝入vbetter memory-space utilization; unused routine is never loaded.vuseful when large amounts of code are needed to handle infrequently occurring caseserror routine vno special support from os is required implemented through program designdue to the users overla

14、ys 覆蓋技術(shù)覆蓋技術(shù)vkeep in memory only those are needed at any given time.vneeded when process is larger than amount of memory allocated to it.vimplemented by user, no special support needed from os, programming design of overlay structure is complex程序的鏈接程序的鏈接v多個(gè)源程序編譯多個(gè)目標(biāo)模塊;庫(kù)。需要鏈接成可裝入模塊v根據(jù)鏈接時(shí)間的不同靜態(tài)鏈接方式:裝入前很早就鏈接裝入時(shí)動(dòng)態(tài)鏈接:邊裝入,邊鏈接運(yùn)行時(shí)動(dòng)態(tài)鏈接:運(yùn)行時(shí)才鏈接靜態(tài)鏈接方式靜態(tài)鏈接方式v靜態(tài)鏈接方式:在程序運(yùn)行之前,先將各目標(biāo)模塊以及它們所需要的庫(kù)函數(shù),鏈接成一個(gè)完整的裝配模塊,以后不再拆開。各目標(biāo)模塊內(nèi):相對(duì)地址存在目標(biāo)模塊之間的調(diào)用關(guān)系外部調(diào)用符號(hào)v要解決的問題:修改相對(duì)地址:多個(gè)相對(duì)地址空間一個(gè)統(tǒng)一的相對(duì)地址空間變換外部調(diào)用符號(hào)裝入時(shí)動(dòng)態(tài)鏈接裝入時(shí)動(dòng)態(tài)鏈接v在裝入時(shí),根據(jù)外部模塊調(diào)

溫馨提示

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

評(píng)論

0/150

提交評(píng)論