IO or CPU bound?

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
mythinky
Posts: 2
Joined: Fri Apr 08, 2005 11:00 pm

IO or CPU bound?

Post by mythinky »

Helo, Can we determine that a process is likely to IO or CPU bound by analysing the source code we built?
Thanks.
rexlunae
Member
Member
Posts: 134
Joined: Sun Oct 24, 2004 11:00 pm
Location: North Dakota, where the buffalo roam

Re: IO or CPU bound?

Post by rexlunae »

mythinky wrote:Helo, Can we determine that a process is likely to IO or CPU bound by analysing the source code we built?
Thanks.
Yes.
mythinky
Posts: 2
Joined: Fri Apr 08, 2005 11:00 pm

Re: IO or CPU bound?

Post by mythinky »

Why? Any short justification?
Thanks
rexlunae
Member
Member
Posts: 134
Joined: Sun Oct 24, 2004 11:00 pm
Location: North Dakota, where the buffalo roam

Re: IO or CPU bound?

Post by rexlunae »

Well, obviously, if you know the speed of your processor, and some average stats about the performance of your IO devices, and you can look at the source code for your OS, as well as the code you wrote, you should be able to tell pretty exactly if your process will be waiting on the CPU or the IO more often. It's possible, but it isn't easy, and it probably isn't a good idea "by analysing the source code we built" as you say. In most cases, such detail is not necessary, because it will be pretty obvious, either by the nature of what you are doing, or by using top or ps (in Unix) to see what the process is usually doing. If it is not obvious, and simple tools like top and ps are not accurate enough, or not available, try breaking the program into pieces, each of which can be expected to predominantly need either IO or CPU, and track the amount of time spent in each piece, tallying the time into IO and CPU columns.

Of course all of these methods assume specific hardware, and if you optimize to much for one specific configuration, you might impact the performance of others drastically.

If my initial response seemed terse, consider that your original question was a "yes or
no" question.

I'm not an expert on this, but these are things that occur to me. There may be experts here who can answer better, and if there are, I hope they speak up, especially in the foreseeable situation where something I proposed would not work at all.
Last edited by rexlunae on Tue Apr 12, 2005 11:00 pm, edited 1 time in total.
Post Reply