作者assassin88 (...)
看板Grad-ProbAsk
標題[理工] [OS]-paging 計算
時間Thu Dec 24 00:50:49 2009
Consider the folling hardware configuration. Virtual address 32 bits, page
size 4KBytes, and a page table entry occupies 4Bytes. How many pages should
the OS allocate for the page tables of a 12MByte process under the folling
paging mechanisms?
(1)one-level paging.
(2)two-level paging.(Assume thar the number of entries in a first-level page
table is the same as that in a second-level table)
另外想請問,什麼是N-Step SCAN?
希望各位指導..感謝
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.57.78.159
1F:推 converse2006:是在問page table需要的數量嗎? 如果是的話 12/24 01:30
2F:→ converse2006:one-level只有一張 two-level需要四張 page table 12/24 01:30
3F:→ converse2006:one-level page table entry數量=2^(32-12)=2^20 12/24 01:32
4F:→ converse2006:two-level page table entry數量2^((32-12)/2)=2^10 12/24 01:32
5F:→ converse2006:process所需page數 (12*2^20)/(4*2^10)=3*2^10 12/24 01:34
6F:→ converse2006:故one-level一張就放的下 two-level需要三張+第一層 12/24 01:35
7F:→ converse2006:有錯請告知^^" 12/24 01:35
8F:→ converse2006:只聽過SCAN/CSCAN Q_Q 12/24 01:36
9F:→ assassin88:答案是3跟4張..我算的你你的和他給的都不同Orz.. 12/24 09:40
10F:推 converse2006:第一個要三張 還蠻妙的..... 兩層都才只需要四張 12/25 00:57
11F:推 Jimmy0301:是三張應該沒錯,因為page size 4kbytes有十二個BITS 12/29 00:45
12F:→ Jimmy0301:為page offsets 則用20bits表示頁碼則有2^20個 12/29 00:46
13F:→ Jimmy0301:page entry 每個entry 4Bytes所以是4x2^20一張pagetable 12/29 00:47
14F:→ Jimmy0301:大小,再用12MB除以4x2^20就是三了 12/29 00:48