[理工] [計組]-I/O

看板Grad-ProbAsk作者 (寂寞邊界)時間16年前 (2010/01/07 00:57), 編輯推噓4(409)
留言13則, 2人參與, 最新討論串1/4 (看更多)
題目 Assume that the initial setup of a DMA transfer takes 1000 clock cycles for the processor,and assume the handling of the interrupt at DMA completion requires 500 clock cycles for the processor.The hard disk has a transfer rate of 4MB/sec and uses DMA.If the average transfer from the disk is 8KB ,what fraction of the 500MHz processor is consumed if the disk is actively transferring 100% of the time?Ignore any impact from bus contention between the proceesor and DMA controller. 答案 (1)每次DMA傳送所花費的時間=8KB/(4MB/sec)=2 * 10^-3 sec ((1000+500)clock/次) (2)硬碟每秒所花費的時clock cycle = --------------------- =750*10^3 clock/sec 2 * 10^-3 sec/次 為什麼可以拿 DMA的setup time+handling interrup time來除以DMA傳送時間呢? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.42.215.32

01/07 01:37, , 1F
會不會是一秒可以執行多少個DMA傳送*每個傳送的cost
01/07 01:37, 1F

01/07 01:38, , 2F
(1000+500)*[1/(2*10^-3)]
01/07 01:38, 2F

01/07 01:47, , 3F
那為什麼傳送的時間不是硬碟花費的一部份?
01/07 01:47, 3F

01/07 01:56, , 4F
應該說DMA一秒可以傳送 4MB/8KB 次 一次需(1000+500)
01/07 01:56, 4F

01/07 01:57, , 5F
cycle time 故一秒需 [(4*10^3)/(8*10^2)]*(1500)
01/07 01:57, 5F

01/07 01:59, , 6F
上面單位好像打錯了 不太常用10當底@@
01/07 01:59, 6F

01/07 02:02, , 7F
你的算法是一次需幾秒 那一秒需幾次*cost
01/07 02:02, 7F

01/08 00:23, , 8F
我只是按照解答打上來而已~可能為了好計算吧
01/08 00:23, 8F

01/08 00:27, , 9F
但DMA的步驟不是 1.cpu設定初值給DMA
01/08 00:27, 9F

01/08 00:29, , 10F
2.I/O device與memory傳送資料
01/08 00:29, 10F

01/08 00:30, , 11F
3.傳送完成利用interrupt通知os並release memory bus嗎?
01/08 00:30, 11F

01/08 00:30, , 12F
data bus
01/08 00:30, 12F

01/08 00:34, , 13F
為什麼不用將傳送時間一起算進去?(2000+1000+2*10^6)ns
01/08 00:34, 13F
文章代碼(AID): #1BHC471B (Grad-ProbAsk)
文章代碼(AID): #1BHC471B (Grad-ProbAsk)