作者yesa315 (XD)
看板Grad-ProbAsk
标题Re: [理工] [OS]-Virtual memory计算问题
时间Thu Oct 1 19:47:24 2009
※ 引述《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)