Re: Best way to design multithreading application



anonymous wrote:
Threading will improve performance on a single processor machine if your threads are working on disparate resources.

That's right. That would be an example of an algorithm that can be parallelized, which I mentioned. My specific example was of one that could do CPU-intensive work in parallel, but it applies to any situation in which mutually independent tasks are using unrelated resources.

[...] I've noticed that in your problem you're reading
from the hard drive and processing the data, so you should see a performance boost, becuase you can have the cpu processing the data while your reading more data in. That being said I don't know if you'll see the performance boost you're looking for.

It's not my problem. It's Dave's problem.

As for whether threading will improve performance, we don't have the information to know for sure if it will. However, from his original post it does not sound like there's any significant CPU work involved. He's essentially got a chain of i/o, each link dependent on the previous. Since a given link in the chain can't do anything with the data until the previous link is done with it, threading isn't going to improve throughput.

Which is not to say it's not potentially useful. The use of threads can address other issues, such as allowing the UI to remain responsive. It's just not clear from the problem description that threading is going to help overall throughput.

Pete
.



Relevant Pages

  • Re: [PATCH 1/3] Separate IRQ-stacks from 4K-stacks option
    ... >>the irq threading must have a cost, ... different resources at the same time, keeping more resources busy. ... this can increase overall system throughput significantly. ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: perl multithreading performance
    ... Also lets not forget that Perl at least supports preemptive threading. ... consumer threads (400 because that is what provided a throughput of 30_000 ... I'd just start 4 processes assigning each a different chunk of the ...
    (comp.lang.perl.misc)