开发者

How to distinguish between I/O bound and CPU bound jobs ?

开发者 https://www.devze.com 2023-03-09 05:06 出处:网络
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 bu

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 ca开发者_StackOverflow中文版lculated without processing the program?


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 bound uses more of its time doing computations than I/O bound.


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 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号