Re: How to program multicore
Quote:
I tried multithreading on a dualcore machine with the same idea that one thread does the calculation while the other thread displaying results, but the two cores do not process simultaneously.
And how did you find that out?
Re: How to program multicore
Quote:
Originally Posted by
ktxn
..., but the two cores do not process simultaneously.
Why would you expect them to? According to your description, the first thread does intensive calculations and the second thread displays results. Assuming that the two thread are on separate cores (probably reasonable), then the the second thread has nothing to do until the first thread sends it results for display. This matches your observed behavior.
In your scenario, mutithreading provides the advantage that the GUI stays alive while the intensive calculation proceeds. But in this scenario, multithreading does not provide a time/speed advantage.
To obtain a time/speed advantage, the intensive calculation must itself be multithreaded. That generally can be hard to do, unless the intensive calculation has some nice parallel properties.
Mike