I/O密集型和CPU密集型

定义

在计算机科学中,I/O bound指的是完成计算所需时间取决于I/O操作的时间,也就是指系统的CPU效能相对硬盘/内存的效能要好很多,系统大部分时间开销都花在了I/O上,导致CPU长时间处于空闲状态;CPU bound(计算密集型)与此相反,指的是I/O设备长期处于空闲状态。

原理分析(wikipedia)

  The Von Neumann architecture, which is employed by many computing devices, is based on a logically separate central processor unit which requests data from main memory,[clarification needed] processes it and writes back the results. Since data must be moved between the CPU and memory along a bus which has a limited data transfer rate, there exists a condition that is known as the Von Neumann bottleneck. Put simply, this means that the data bandwidth between the CPU and memory tends to limit the overall speed of computation. In terms of the actual technology that makes up a computer, the Von Neumann Bottleneck predicts that it is easier to make the CPU perform calculations faster than it is to supply it with data at the necessary rate for this to be possible.

  In recent history, the Von Neumann bottleneck has become more apparent. The design philosophy of modern computers is based upon a physically separate CPU and main memory. It is possible to make the CPU run at a high data transfer rate because data is moved between locations inside them across tiny distances. The physical separation between CPU and main memory, however, requires a data bus to move data across comparatively long distances of centimetres or more. The problem of making this part of the system operate sufficiently fast to keep up with the CPU has been a great challenge to designers.[2]

现阶段大量使用的冯洛伊曼结构的设备是基于逻辑上分开的中央处理单元的,重要处理器从内存读取数据,再把处理的结果回写到内存。数据在CPU和内存上的传输依赖总线,而总线有一个极限的传输速率,也就是众所周知的维纳瓶颈。简单来说,这意味着CPU和内存之间的传输速度开始制约计算机的速度。最新的技术使得容易使CPU的执行速度超过所需要的速度。

近年来,冯洛伊曼瓶颈变得显而易见。现有的设计哲学都是基于CPU和内存物理隔离的。由于数据总是在很短的距离内移动,因此很容易使CPU在很高的传输速率下运行。而CPU和内存在物理上的隔离导致数据总线需要长距离的传输数据。因此,是的这一部分快速运转以跟上CPU的速度是设计者面临的主要挑战。

      在多重程序系统中,大部份时间用来做计算、逻辑判断等CPU动作的程序称之CPU bound。例如一个计算圆周率至小数点一千位以下的程序,在执行的过程当中绝大部份时间用在三角函数和开根号的计算,便是属于CPU bound的程序。CPU bound的程序一般而言CPU占用率相当高。这可能是因为任务本身不太需要访问I/O设备,也可能是因为程序是多线程实现因此屏蔽掉了等待I/O的时间。而I/O bound的程序一般在达到性能极限时,CPU占用率仍然较低。这可能是因为任务本身需要大量I/O操作,而pipeline做得不是很好,没有充分利用处理器能力。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值