作者qazwsxee (小堯)
看板Grad-ProbAsk
標題Re: [理工] [OS]-E.A.T
時間Sun Nov 29 04:44:08 2009
※ 引述《cansister (cansister)》之銘言:
: ※ 引述《yesa315 (XD)》之銘言:
: : Consider a demand-paging system with a paging disk that has an average
: : access and transfer time of 20 milliseconds.Addresses are translated
: : through a page table in main memory, with an access time of 1 microsecond
: : per memory access. Thus, each memory reference through the page
: : table takes two accesses. To improve this time, we have added an
: : associative memory that reduces access time to one memory reference,
: : if the page-table entry is in the associative memory.
: : Assume that 80 percent of the accesses are in the associative memory
: : and that, of the remaining, 10 percent (or 2 percent of the total) cause
: : page faults.What is the effective memory access time?
: : 恐龍本習題 跟95政大的考題類似 但給的答案
: : EAT = (0.8) × (1 us) + (0.1) × (2 us) + (0.1) × (5002 us)
: : = 501.2 us
: : = 0.5 ms
: : 其中 5002us 滿怪的 我算的是 應該2*20 ms + 2*1 us =40002us
: : 有高手可以解釋整個架構嗎?
: : 謝謝!
: EAT = (0.8)*(1us) + (0.2)*(1us + (1-0.1)*(1us) + (0.1)*(20ms))
: = 0.8us + 0.2us + 0.18us + 400us
: = 401.18us
: = 0.4ms
: 想法:
: EAT = (TLB hit)+(TLB miss)
: = (1次 memory access) + (1次memory access + 資料存在時1次 + 資料不存在時)
: 讀取page table資料 memory access page fault
: 這樣對嗎?? 我不是很確定
我覺得他題目給的答案是錯的(恐龍本也不一定就是對的)
of the remaining, 10 percent (or 2 percent of the total)
=>剩下的機率 的 再10%
=>(20%) 就是 (2%)
這是其中一行題目~解答沒有考慮到是2%造成page fault~機率就寫錯了~
以下是我的見解:
考慮1個 需求分頁 系統
(1) 使用paging disk
=>發生page faults後 average (access and transfer time) = 20 milliseconds
(2) an access time of 1 microsecond per memory access. => 1us
(3) page table in main memory
=> 每次參考 需要 2次 (存取page table所在位址 + 存取實體位址)
(4) 加入一個associative memory
使得 減少存取時間of one memory reference
(5) if the page-table entry is in the associative memory.
就是使用所謂的 TLB
associative memory access time 沒寫 通常是省略(因為極快~近似0)
(20%機率的其中再90%可在此取得 = 18% of the total)
| (存取Main memory上的 page table所在位
| 址 + 實體位址 =1us+1us )
(其餘的20%機率中) | |
| | |
| | | (其餘的20%機率的再10%機率只能
(80% TLB hit) | | | 去disk取 =2% of the total)
| | | | |
↓ ↓ ↓ ↓ ↓
: (0.8)*(1us) + (0.2) * [0us + (0.9)*(2us) + (0.1)*( 1us +20ms + 0us+ 2us )]
↑ | | | | |
| ↓ | | | |
| (TLB Miss成本) | | | |
| | | | |
| | | | |
| (page Miss成本=1us)←— | | |
| | | |
(存取Main memory上實體位址=1us ) | | |
(page fault)←——————— ↓ |
:[替換完之後 還要去] ——→(TLB 再次Miss)|
[Main memory 存取 ] (因為剛放上去)|
| (所以TLB內沒有)|
↓ ↓
(存取Main memory上的 page table所在位址 + 實體位址=1us+1us)
= 0.8us + 0.36us + 0.02 * 20003us
=401.22 us
歡迎討論
--
學長學長!那邊有飆車族 學長學長!那邊剛好像有女生 學長學長!那邊有人紅燈右轉
砍人 被壓上車 ψQSWEET
鴿 ◥ 鴿 ◥ 鴿 ◥ 鴿 ◥ 鴿 ◥他媽的◤ 鴿
◤◎ ◎ 喔~~ ◤︶ ︶ ◤◎ ◎ 喔~~ ◤︶ ︶ ◤◎ ◎ 攔下來呀!⊙ ⊙◥
◥ ◤ ◥ █◤ ◥ ◤ ◥ 3◤╯ξ
◥ ◤沒王法了◥皿 ◤
◥ ◥◥ (哈欠)◤ ◥◤ ◥ ◥◥ (煙~) ◤ ◥ ◤ ̄ ◥ ◥◥是不是?!(
◥ ◤ ◤)
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 61.227.112.246
※ 編輯: qazwsxee 來自: 61.227.112.246 (11/29 04:47)
※ 編輯: qazwsxee 來自: 61.227.112.246 (11/29 04:49)
→ dolphin0111:最後那邊應該不用算page miss吧! 12/21 18:57
→ dolphin0111:好像又要 12/22 08:32
→ dolphin0111:我覺得那個page miss我不太懂他的意思 12/22 08:44
→ dolphin0111:感覺那個地方應該是指hit time 12/22 08:45
→ dolphin0111:當搬到Cache之後再去access data 12/22 08:46
推 comaniac:page Miss成本 和 存取...中略...所在位址 有什麼不同@@? 12/30 02:01
→ comaniac:照理說發生page miss後不會先去存實體位置(因為miss) 12/30 02:02
→ comaniac:而是去disk抓data(20ms),抓回來後才存取memory 12/30 02:02
→ comaniac:所以這個動作不會做兩次,有錯請指教m(_ _)m 12/30 02:03
推 yesa315:page miss要先查page table才能得知實體位置 12/30 10:14