Re: Virtual memory计算

楼主: alanineaton (Fuduki Sakana)   2010-02-18 12:52:50
※ 引述《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
: 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)
: 请问有学长姐知道怎算吗?谢谢。
我不是台大的学长姐,不过我来试试看好了。
page size=4KB
每个page entry的资料=4byte
a.
12M/4K = 3K(全部所需page entry数)
3K*4byte(page总容量)
3K*4/4K=3 #
b.
page offset=page bit数=12bit(因为4K=2^12)
page number=32-12=20
因L1=L2,所以L1 page num=10,L2 page num=10。
即page entry数=2^10=1K
12M/4K = 3K
3K/1K=3(L2 page table)
然后需用到1个L1的page table去查询L2的table
所以总page数=3(L2)+1(L1)=4 #

Links booklink

Contact Us: admin [ a t ] ucptt.com