Previous | Next --- Slide 63 of 64
Back to Lecture Thumbnails
dmerigou

Is the greedy policy better than the stalling join or are there tradeoffs between the two?

rohany

I believe that using a greedy scheduling policy can approximate optimal scheduling within a factor of 2, so I think greedy is the best way to go. Optimal scheduling is NP-complete, so we can at best hope for a close approximation.

rsvaidya

I feel greedy policy will be better because the first calling thread need not wait in this and keep checking for the current state of the sync. Also since all program state is already copied in the thread running the last part , it will be efficient to continue there itself rather than copying it back to the original thread.

chenboy

I believe the greedy policy is better than the stalling join in most of the cases, the reason is twofold. Firstly, greedy policy will have better chances to keep all of the threads busy because as long as they're idle, they will keep stealing workload from other threads, which will not happen under stalling join. Secondly, as @rsvaidya said, the latest finishing thread will continue to do the work after the sync() point, which may also save some time.

woohoo

When would the stalling join policy be better?