看板 Grad-ProbAsk 關於我們 聯絡資訊
題目 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
converse2006:會不會是一秒可以執行多少個DMA傳送*每個傳送的cost 01/07 01:37
converse2006:(1000+500)*[1/(2*10^-3)] 01/07 01:38
killerjoe:那為什麼傳送的時間不是硬碟花費的一部份? 01/07 01:47
converse2006:應該說DMA一秒可以傳送 4MB/8KB 次 一次需(1000+500) 01/07 01:56
converse2006:cycle time 故一秒需 [(4*10^3)/(8*10^2)]*(1500) 01/07 01:57
converse2006:上面單位好像打錯了 不太常用10當底@@ 01/07 01:59
converse2006:你的算法是一次需幾秒 那一秒需幾次*cost 01/07 02:02
killerjoe:我只是按照解答打上來而已~可能為了好計算吧 01/08 00:23
killerjoe:但DMA的步驟不是 1.cpu設定初值給DMA 01/08 00:27
killerjoe:2.I/O device與memory傳送資料 01/08 00:29
killerjoe:3.傳送完成利用interrupt通知os並release memory bus嗎? 01/08 00:30
killerjoe: data bus 01/08 00:30
killerjoe:為什麼不用將傳送時間一起算進去?(2000+1000+2*10^6)ns 01/08 00:34