作者onlymonster (手守云鬼)
看板Grad-ProbAsk
標題Re: [理工] OS virtual memory
時間Sat Dec 15 19:39:00 2012
※ 引述《kiwidoit (伊佛利特)》之銘言:
: 1.
: virtual address = 32 bits
: page size = 4Kbytes
: a page table entry occupies 4 bytes
: 問題: How many pages should the OS allocate for the pages tables of a
: 12 MByte process under the following mechanisms?
: (1)one-level paging.
page size = 4kbytes = 2^12 bytes => 12bit offset
12MB = 3*(2^22)bytes => (3*(2^22))/(2^12) = 3*(2^10) 個pages
=> 需要3*(2^10)entries的page table
一個page可以放(2^12)/4 = 2^10個entries
所以總共需要(3*(2^10))/(2^10) = 3個pages來當pagetable
: (2)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)
(1)的3 < 2^10 一個page夠指到(1)的pages
再拿一個page去對應(1)的那三個page => 3+1 = 4 個pages
(不確定能不能這想...)
: 2.
: Assume we have a demand-paging memory. The page table is held in
: registers. It takes 8 milliseconds to service a page fault if an
: empty page is available or the replaced page is not modified, and 20
: milliseconds if the replaced page is modified. Memory access time is
: 100 nanoseconds. Assume that the page to be placed is modified 70 percent
: of the time. What is the maximum acceptable page-fault rate for an effective
: access time of no more that 200 nanoseconds?
: 請問我下面這樣列式為什麼是錯的0.0?
: 假設page fault rate = p
: 200ns >= (1-p)*100ns+0.7p*(20ms+200ns)+0.3p*(8ms+200ns)
這題我也不確定...
我是算(1-p)*100ns + p*(0.3*8ms + 0.7*20ms) < 200ns
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.0.213
推 kiwidoit:感謝 來去研究研究 12/17 17:01
推 kiwidoit:YES,大概了解 感謝你!! 12/17 21:59