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

下載本文檔

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

文檔簡介

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

2、mputer system can be organized in a hierarchyvSpeed, access timevCost per bitvVolatility主存主存 vs. 存放器存放器vSame: Access directly for CPUvRegister namevMemory addressvDifferent: access speedvRegister, one cycle of the CPU clockvMemory, Many cycles (2 or more)vDisadvantage: vCPU needs to stall frequently

3、 & this is intolerablevRemedyvCache高級緩沖技術(shù)高級緩沖技術(shù)cachingvCachingvCopying information into faster storage systemvWhen accessing, first check in the cache, ifvIn: use it directlyvNot in: get from upper storage system, and leave a copy in the cachevUsing of cachingvRegisters provide a high-speed cach

4、e for main memoryvInstruction cache & data cachevMain memory can be viewed as a fast cache for secondary storagevMagnetic disks 磁盤磁盤v Transfer time 傳輸時(shí)間v TT data size * Transfer ratev Transfer rate (n M/s)-1 ( n Byte/us )-1 1/n us/Bytev Positioning time 定位時(shí)間v Seek time 尋道v Tsv Rotational latency

5、 旋轉(zhuǎn)延遲v TRv TP Ts +TR m msv TT VS. TPv Please Store data closely 內(nèi)容提要內(nèi)容提要v存儲(chǔ)器的層次構(gòu)造v程序執(zhí)行的根底知識、程序的裝入和鏈接v延續(xù)分配存儲(chǔ)管理方式v分頁存儲(chǔ)管理方式v分段存儲(chǔ)管理v段頁式存儲(chǔ)管理程序執(zhí)行的根底知識程序執(zhí)行的根底知識vVon Neumann architecture 馮諾依曼體系構(gòu)造圖vProgram must be brought into memoryvMain memory is usually too smallvProcessvProgram must be placed within a pr

6、ocess for it to be executedv作業(yè)池vUser programsvWhere to place the programvseveral steps圖地址的類型地址的類型vAbsolute address 絕對地址vAddress seen by the memory unitvPhysical address 物理地址vRelative address 相對地址vLinear address 線性地址vLogical address 邏輯地址vGenerated by the CPUvVirtual address 虛擬地址vWhen can the absolute

7、 address can be decided?Address binding 地址的綁定地址的綁定Address binding 地址綁定地址綁定, the binding of instructions and data to memory, 可以在三種時(shí)辰進(jìn)展可以在三種時(shí)辰進(jìn)展Compile timeIf memory location known a priori, absolute code can be generated; must recompile code if starting location changes.Load timeMust generate relocat

8、able code if memory location is not known at compile time.Execution timeBinding 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 addre

9、ss space 邏輯地址空間v The set of all logical addresses generated by a programv Physical address space 物理地址空間v The set of all physical addresses corresponding to theses logical addresses v Logical = physical v compile-time & load-time address-bindingv logical (virtual) != physical addresses v executio

10、n-time address-bindingv MMU (hardware device)Memory-Management Unit (MMU)v Hardware device, 邏輯地址 物理地址v Relocation register 重定位存放器v Added to every address generated by a user process at the time it is sent to memoryv E.g. MS-DOS on 80 x86v User program deals with logical addresses, it NEVER sees the

11、real physical addresses.能否需求將進(jìn)程的一切代碼和數(shù)據(jù)一次性裝入?能否需求將進(jìn)程的一切代碼和數(shù)據(jù)一次性裝入?vShall we put the entire program & data of a process in physical memory before the process can be executed?vFor better memory space utilizationvDynamic loadingvDynamic linkingvOverlaysvSwappingv程序的裝入程序的裝入v絕對裝入方式v可重定位裝入方式v動(dòng)態(tài)運(yùn)轉(zhuǎn)時(shí)裝入方式

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

13、時(shí)機(jī)即從相對地址到絕對地址的轉(zhuǎn)換推遲到程序真正執(zhí)行時(shí)才進(jìn)展v因此,裝入內(nèi)存中的代碼和數(shù)據(jù)的地址依然是相對地址v需求重定位存放器的支持動(dòng)態(tài)運(yùn)轉(zhuǎn)時(shí)裝入方式動(dòng)態(tài)運(yùn)轉(zhuǎn)時(shí)裝入方式v根據(jù)程序運(yùn)轉(zhuǎ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 casesvError routine vNo special support from

14、OS is required implemented through program designvDue to the users Overlays 覆蓋技術(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è)目的模塊;庫。需求鏈接成可裝入模塊v根據(jù)鏈接時(shí)間的不同v靜態(tài)鏈接方式:裝入前很早就鏈接v裝入時(shí)動(dòng)態(tài)鏈接:邊裝入,邊鏈接v運(yùn)轉(zhuǎn)時(shí)動(dòng)態(tài)鏈接:運(yùn)轉(zhuǎn)時(shí)才鏈接靜態(tài)鏈接方式靜態(tài)鏈接方式v靜態(tài)鏈接方式:在程序運(yùn)轉(zhuǎn)之前,先將各目的模塊以及它們所需求的庫函數(shù),鏈接成一個(gè)完好的裝配模塊,以后不再拆開。v各目的模塊內(nèi):相對地址v存在目的模塊之間的調(diào)用關(guān)系v外部調(diào)用符號v要處理的問題:v修正相對地址:多個(gè)相對地址空間一個(gè)一致的相對地址空間v變換外部調(diào)用符號裝入時(shí)動(dòng)態(tài)鏈接裝入時(shí)動(dòng)態(tài)鏈接v在裝入時(shí),根據(jù)外部模

溫馨提示

  • 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)僅提供信息存儲(chǔ)空間,僅對用戶上傳內(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

提交評論