On 9 May 2011, at 21:03, kxng wrote:
> my test program now looks like this:
>
> main thread:
> initialize sharedArray[i] = -1
> create thread from start_cb()
> call output()
>
> output()
> {
> for (i..30000)
> {
> while(sharedArray[i] != -1) Sleep(10)
> display sharedArray[i]
> }
> }
>
> worker thread:
> {
> for (i .. 30000)
> {
> sharedArray[i] = xxx
> }
> }
>
>
> but the running time of the worker thread takes 3 times more than running
> without using multithreading in single core, even running it in dualcore. is
> there a better approach? and why running on multicore does not help?
Sorry - I can't figure out from your pseudocode what you are actually doing.
Can you post a simplified, minimal, compileable example that we can look at, to
see what you are actually doing.
There is insufficient information here to say anything helpful...
However, as an attempt to at least appear helpful (!) then threading and using
multiple cores should be faster. You are using windows I think - what does
TaskManager show? How many cores does it show as being utilised, and what CPU
load is it reporting?
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk