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