作者killerjoe (寂寞边界)
看板Grad-ProbAsk
标题[理工] [计组]-I/O
时间Thu Jan 7 00:57:40 2010
题目
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
1F:推 converse2006:会不会是一秒可以执行多少个DMA传送*每个传送的cost 01/07 01:37
2F:→ converse2006:(1000+500)*[1/(2*10^-3)] 01/07 01:38
3F:→ killerjoe:那为什麽传送的时间不是硬碟花费的一部份? 01/07 01:47
4F:推 converse2006:应该说DMA一秒可以传送 4MB/8KB 次 一次需(1000+500) 01/07 01:56
5F:→ converse2006:cycle time 故一秒需 [(4*10^3)/(8*10^2)]*(1500) 01/07 01:57
6F:推 converse2006:上面单位好像打错了 不太常用10当底@@ 01/07 01:59
7F:推 converse2006:你的算法是一次需几秒 那一秒需几次*cost 01/07 02:02
8F:→ killerjoe:我只是按照解答打上来而已~可能为了好计算吧 01/08 00:23
9F:→ killerjoe:但DMA的步骤不是 1.cpu设定初值给DMA 01/08 00:27
10F:→ killerjoe:2.I/O device与memory传送资料 01/08 00:29
11F:→ killerjoe:3.传送完成利用interrupt通知os并release memory bus吗? 01/08 00:30
12F:→ killerjoe: data bus 01/08 00:30
13F:→ killerjoe:为什麽不用将传送时间一起算进去?(2000+1000+2*10^6)ns 01/08 00:34