第三章 存儲管理(memory management)武漢工業(yè)_第1頁
第三章 存儲管理(memory management)武漢工業(yè)_第2頁
第三章 存儲管理(memory management)武漢工業(yè)_第3頁
第三章 存儲管理(memory management)武漢工業(yè)_第4頁
第三章 存儲管理(memory management)武漢工業(yè)_第5頁
已閱讀5頁,還剩152頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、LibraryModule#1Module#2Module#nLinkerLoadModuleLoaderRAM Maintains the states of partitionsUsing the logical segment no as the index to find the correspondent physics segment(使用邏輯段號作(使用邏輯段號作為索引查段表得到物理段號);為索引查段表得到物理段號);Physics address= offset in logical address + start address in segment table entry;

2、 Protection: If the offset in logical address is large than the length in the segment table entry, a protection error will generate and OS will process the error. const int BUFFSIZE=256; int main() char * buff=(char *)malloc(BUFFSIZE);/平臺無關sprintf(buff,”%s”,”Hello World”);/sleep(10000);/for kswapdfr

3、ee(buff); /平臺無關return SUCCESS; ./ hello world /實現(xiàn)映射,使用物理內存,運行時分配,運行完回收v Modify BitP h y s i c a l M e m o r y P a g e T a b l e P a g e D i r e c t o r y T w o L e v e l P a g e T a b l e Virtual Address Page# Offset Page# Entry Chain (Hash) Frame# Hash Table Inverted Page Table Frame# Offset Real A

4、ddress Invert Page Table v Segment Limit Check OS uses special register to maintain the length of segment table and the length of every segment.v Access Control Every segment table entry has several access control bits to define the access limit.v Privilege Ring Every segment table entry has define

5、the privilege for process running in a ring.v A program can access the data which is in the same ring or lower privilege ring.v A program can call the functions which are in the same ring or higher privilege ring.v Paging, which is transparent to the programmer, eliminates external fragmentation and

6、 reduces the internal fragmentation, and thus provides efficient use of main memory.v Segmentation, which is visible to the programmer, has the ability to handle growing data structures, modularity, and support for sharing and protection.v To combine the advantages of both, using segmentation/paging

7、.v The design of memory management portion of an OS depends on three fundamental areas of choice:v The choices made in the first two areas depend on the hardware platform available. All important OS provide virtual memory. Pure segmentation systems are becoming rare.v The choices in the third areas

8、are the domain of OS. Gives a process a fixed number of pages within which to execute. The number is decided at initial load time and may be determined based on the type of process. When a page fault occurs, one of the pages of that process must be replaced by the needed page. The number of page fra

9、mes allocated to a process to be varied over the lifetime of the process. The number of pages allocated to a process can be decided by the page fault rate.v On a nonuniform memory access (NUMA), multiprocessor, the distributed, shared memory of the machine can be referenced by any processor on the m

10、achine, but the time for accessing a particular physical location varies with the distance between the processor and the memory module.v Thus, performance depends on the extent to which data reside close to the processors that use them. A page is brought into main memory only when a reference is mad

11、e to a location on that page. As more and more pages are brought in, page faults should drop to a very low level. Chooses only among the resident pages of the process that generated the page fault in selecting a page to replace.v How to determine resident set size and the timing of changes.-working

12、set strategy Page Address Stream 2 3 2 1 5 2 4 5 3 2 5 2 2 2 2 2 2 2 4 4 4 2 2 2 3 3 3 3 3 3 3 3 3 3 3 1 5 5 5 5 5 5 5 5 F F F F F F O OP PT T a al lg go or ri it th hm m Page Address Stream 2 3 2 1 5 2 4 5 3 2 5 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 1 1 1 4 4 4 2 2 2 F F F F F F F L LR RU

13、 U a al lg go or ri it th hm m v Examination of large numbers of traces of programs with sequential reference patterns shows that LRU performs poorly. Page Address Stream 2 3 2 1 5 2 4 5 3 2 5 2 2 2 2 2 5 5 5 5 3 3 3 3 3 3 3 3 2 2 2 2 2 5 5 1 1 1 4 4 4 4 4 2 F F F F F F F F F F FI IF FO O a al lg go or ri it th hm m v FIFO is a simple algorithm and is easy to implement.v For a program that has sequential reference patterns, FIFO can get good performanc

溫馨提示

  • 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

提交評論