如何区分 I/O 密集型作业和 CPU 密集型作业?
长期调度程序如何决定哪个作业是 I/O 密集型作业,哪个作业是 CPU 密集型作业?
我听说通过使用 cpu 突发我们可以区分 I/O 密集型作业和 CPU 密集型作业,但是在不处理程序的情况下如何计算 CPU 突发呢?
How does a long term scheduler decide which job is I/O bound and which one is CPU bound?
I heard that by using cpu burst we can distinguish between I/O bound and CPU bound jobs, but how is the CPU burst calculated without processing the program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一般来说,CPU 调度程序会为进程/线程分配时间片,并在 a) 时间片用完或 b) 进程/线程阻塞 I/O 时在它们之间进行切换。
I/O 密集型作业经常会阻塞 I/O,而始终使用其完整时间片的进程/线程可以假定为 CPU 密集型。因此,通过区分进程/线程是否在时间片结束时阻塞或通过调用某些 wait_for_io_completion() 函数,您可以有效地表征这些类型的进程。
请注意,在现实生活中,事情会变得更加复杂,因为大多数时候应用程序既不是 I/O 密集型的,也不是 CPU 密集型的,而是一直在切换角色。这就是为什么调度是关于启发法而不是正确的解决方案,因为你不能(总是)预测未来。
Generally, the CPU scheduler assigns time slices to processes/threads and switches between them whenever a) the time slice has run out or b) the process/thread blocks for I/O.
An I/O-bound job will be blocking for I/O very often, while a process/thread that always makes use of his full time slice can be assumed to be CPU-bound. So by distinguishing whether a process/thread blocks at the end of the time slice or by calling some wait_for_io_completion() function, you can effectively characterize those types of processes.
Note, that in real life, things get more complicated, because most of the time applications are not either I/O-bound or CPU-bound but switch roles all the time. This is why scheduling is about heuristics and not about correct solutions, because you cannot (always) predict the future.
CPU 限制比 I/O 限制使用更多的时间进行计算。
CPU bound uses more of its time doing computations than I/O bound.
由图迈尼·卡米·大卫回答
答案。一般来说,CPU 调度程序会为进程/线程分配时间片,并在 a) 时间片用完或 b) 进程/线程阻塞 I/O 时在它们之间进行切换。 ... CPU 限制比 I/O 限制使用更多的时间进行计算。strong text
answered by tumaini kami david
Answers. Generally, the CPU scheduler assigns time slices to processes/threads and switches between them whenever a) the time slice has run out or b) the process/thread blocks for I/O. ... CPU bound uses more of its time doing computations than I/O bound.strong text
IO 绑定过程:
Io 绑定进程花在 io 上的时间多于计算的时间,许多短暂的 cpu 突发。
结合工艺:
进程花费更多时间进行计算;很少有很长的 CPU 突发。
IO BOUND PROCESS :
Io bound process spends more time doing io than computations,many short cpu burst.
COU BOUND PROCESS :
process spends more time doing computations;few very long cpu bursts.