Re: [理工] [OS]-multi level paging
※ 引述《bernachom (Terry)》之銘言:
: 請教一下..
: 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)這題要怎麼算呢?
: 謝謝幫忙
※更正一下,換個想法看看
a) 12MB/4KB = 3K (代表這個process需要3K個page→代表PT需要3K個entry)
→再來計算 3K * 4byte = 12KB (代表這3K個entry佔12KB)
→12KB / 4KB = 3 (總共需要3個page)
b) 12MB /4KB =3K
→因為現在變成 2-level,所以第二層的PT只能貢獻2^10個entry
→由a知該Process需要3K個page
→3K / 2^10 = 3 (代表第二層需要3個page)
→還需要一個第一層對到第二層
→3 + 1 = 4
盡量寫的比較完整
--
◤ ◥ 答 ◤ ◥ 拉 ◤ ◥ 米 ◤ ◥ 哆
Σ ◆ ◆ 蚊 Σ ◆ ◆ 肥 Σ ◆ ◆ 開 Σ ◆ ◆ 啦
︵ 吸 ︵ 兒 ︵ 喇 ︵ 太
◣++++++◢ ◣++++++◢ ◣++++++◢ 雞 ◣++++++◢ 裸
◥▇▆@ ≡ @▆▇◤ Ψ ≡ Ψ ▄ ≡ ▄ 囉 ▄▄▄ ≡ ▄▄▄
▅ ▅ ▄/ ▅ \▄ ▅ AΓVISS
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 122.116.14.2
推
03/02 14:11, , 1F
03/02 14:11, 1F
→
03/02 14:12, , 2F
03/02 14:12, 2F
→
03/02 14:13, , 3F
03/02 14:13, 3F
推
03/02 14:16, , 4F
03/02 14:16, 4F
→
03/02 14:20, , 5F
03/02 14:20, 5F
※ 編輯: polomoss 來自: 122.116.14.2 (03/02 14:38)
→
03/02 14:41, , 6F
03/02 14:41, 6F
→
03/02 14:44, , 7F
03/02 14:44, 7F
→
03/02 14:47, , 8F
03/02 14:47, 8F
→
03/02 14:47, , 9F
03/02 14:47, 9F
→
03/02 14:47, , 10F
03/02 14:47, 10F
推
03/02 14:48, , 11F
03/02 14:48, 11F
討論串 (同標題文章)