[理工] [OS]-multi level paging

看板Grad-ProbAsk作者 (Terry)時間16年前 (2010/03/02 13:23), 編輯推噓6(605)
留言11則, 5人參與, 最新討論串1/3 (看更多)
請教一下.. consider the following hardware configuration virtual address =32 bits, page size=4kbytes, and a page table entry occupies 4 bytes. How many pages should the OS allocate for the pages table of a 12Mbyte process under the following paging mechanisms? a)one-level paging b)two-level paging.(assuming that the number of entries in a first-level page table is the same as that in a second-level page table) ---- a)這題我是這樣算,2^20 * 4 = 4MB, 12MB/4MB=3個page table b)算出來答案很怪... 請教一下,b)這題要怎麼算呢? 謝謝幫忙 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.112.234.203

03/02 13:42, , 1F
第一題好像算錯了 雖然答案對XD
03/02 13:42, 1F

03/02 13:54, , 2F
不是問Pages數目嗎?
03/02 13:54, 2F

03/02 14:10, , 3F
page個數=12MB/4KB=3*2^10
03/02 14:10, 3F

03/02 14:13, , 4F
page table size=3*2^10*4=12kb
03/02 14:13, 4F

03/02 14:14, , 5F
page table佔 12KB/4kB = 3個pages
03/02 14:14, 5F

03/02 14:23, , 6F
請教一下,那B小題呢?謝謝
03/02 14:23, 6F

03/02 14:28, , 7F
b)應該是4個,需要3個2-level page table,所以需要3個
03/02 14:28, 7F

03/02 14:29, , 8F
1-level page entries(只需1個page)對應,故共4個
03/02 14:29, 8F

03/02 14:31, , 9F
所以這題是要算page table數??
03/02 14:31, 9F

03/02 14:33, , 10F
2-level剛好一個page table2^10 entries,需一個page
03/02 14:33, 10F

03/02 16:28, , 11F
算法其實沒錯
03/02 16:28, 11F
文章代碼(AID): #1BZA3PcT (Grad-ProbAsk)
文章代碼(AID): #1BZA3PcT (Grad-ProbAsk)