※ 引述《work76 (work)》之銘言:
: consider the following hardware configuration . virtual address=32bit, page
: size=4kbytes, and a page table entry occupies 4 bytes. how many pages should
: the os allocate for the pages tables of a 12mbyte process under the following
: paging mechanisms?
a. one level paging
12 20
page size=4kbytes = 2 bytes 12mbyte = 12*2 bytes
20 12 8
除以page size 12*2 / 2 = 12 * 2 = 3076 = 3k pages
每個page占一個entry 故 3k * 4bytes = 12 kbytes
b. two level paging.:(assuming that the number of entries in a first leve page
: table is the same as that in a second-level page table)
: 可以幫忙算一下這題嗎?也是完全不會的一題考古題,謝謝。
20 22 24
12mbyte = 12*2 bytes = 3 * 2 < 2 bytes(電腦要以2進位儲存 找最接近
22
3*2 的2的倍數)
故取24 bits
扣到page size 的 12bit 剩12bit
由於要two level (題目說要拆兩半)故12bit 拆成兩半 第一個6bit 做first level
第2個6bit 做 second level table
6
first level=2 * 1(每個entry占1 byte 電腦最小分配資源) =64 bytes
(first level指向second level的entry)
6
second level =2 * 4 bytes (指向記憶體位址 題目給的) = 256 bytes
故共 256 + 64 = 320 bytes
(這是我的見解 可能有錯)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.127.208.96
※ 編輯: yesa315 來自: 140.127.208.96 (10/01 19:49)