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

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、第七講第七講 存儲器管理存儲器管理中國科學技術大學計算機系中國科學技術大學計算機系 陳香蘭陳香蘭2019Fall內容提要內容提要v存儲器的層次構造v程序執(zhí)行的根底知識、程序的裝入和鏈接v延續(xù)分配存儲管理方式v分頁存儲管理方式v分段存儲管理v段頁式存儲管理存儲器的層次構造存儲器的層次構造v存儲器是計算機系統(tǒng)的重要組成部分v容量、價錢和速度之間的矛盾v內存、外存;易失性和永久性v內存,是稀缺資源v在現(xiàn)代計算機系統(tǒng)中,存儲通常采用層次構造來組織v多級存儲器構造v主存與存放器v高速緩存和磁盤緩存多級存儲器構造多級存儲器構造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高級緩沖技術高級緩沖技術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 傳輸時間v TT data size * Transfer ratev Transfer rate (n M/s)-1 ( n Byte/us )-1 1/n us/Bytev Positioning time 定位時間v Seek time 尋道v Tsv Rotational latency

5、 旋轉延遲v TRv TP Ts +TR m msv TT VS. TPv Please Store data closely 內容提要內容提要v存儲器的層次構造v程序執(zhí)行的根底知識、程序的裝入和鏈接v延續(xù)分配存儲管理方式v分頁存儲管理方式v分段存儲管理v段頁式存儲管理程序執(zhí)行的根底知識程序執(zhí)行的根底知識vVon Neumann architecture 馮諾依曼體系構造圖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, 可以在三種時辰進展可以在三種時辰進展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.能否需求將進程的一切代碼和數(shù)據(jù)一次性裝入?能否需求將進程的一切代碼和數(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動態(tài)運轉時裝入方式

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

13、時機即從相對地址到絕對地址的轉換推遲到程序真正執(zhí)行時才進展v因此,裝入內存中的代碼和數(shù)據(jù)的地址依然是相對地址v需求重定位存放器的支持動態(tài)運轉時裝入方式動態(tài)運轉時裝入方式v根據(jù)程序運轉的部分性,讓程序及其數(shù)據(jù)在需求時才被裝入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 覆蓋技術覆蓋技術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多個源程序編譯多個目的模塊;庫。需求鏈接成可裝入模塊v根據(jù)鏈接時間的不同v靜態(tài)鏈接方式:裝入前很早就鏈接v裝入時動態(tài)鏈接:邊裝入,邊鏈接v運轉時動態(tài)鏈接:運轉時才鏈接靜態(tài)鏈接方式靜態(tài)鏈接方式v靜態(tài)鏈接方式:在程序運轉之前,先將各目的模塊以及它們所需求的庫函數(shù),鏈接成一個完好的裝配模塊,以后不再拆開。v各目的模塊內:相對地址v存在目的模塊之間的調用關系v外部調用符號v要處理的問題:v修正相對地址:多個相對地址空間一個一致的相對地址空間v變換外部調用符號裝入時動態(tài)鏈接裝入時動態(tài)鏈接v在裝入時,根據(jù)外部模

溫馨提示

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

評論

0/150

提交評論