Re: [Algorithms] General purpose task parallel threading approach
Brought to you by:
vexxed72
|
From: Jon W. <jw...@gm...> - 2009-04-10 02:30:21
|
Sebastian Sylvan wrote: > You put two tasks (the xyzw one and abcd one) on whichever queue you > start on, the other queue will sit idle just waiting for something to > pop up somewhere and grab the first one to go on the queue. Then the > second one goes on the queue and then there's the final sync which > causes the originating thread to start executing. Regardless of the > order you spawn the task the other thread will take the other one. > There is no opportunity for the xyzw tasks to "skip" past the abcd > ones since you only steal when you've run out (so even if the other > thread takes the xyzw ones it will put the child-tasks on *its* queue, > and the original thread will go ahead and do abcd before trying to steal). There are eight tasks. x, y, z and w are part of the "independent" work group. a, b, c and d are part of the "sequentially dependent" group. That was part of the original problem statement. As you should clearly see in the problem statement, if the tasks xyzw are enqueued before abcd (all on the same thread, then), you will not get optimal performance, because the stealer will steal y after the original thread starts working on x. Sincerely, jw |