Previous | Next --- Slide 62 of 64
Back to Lecture Thumbnails

What does block A descriptor do in here? Is it a descriptor just coming with spawn and done? (giving them scope)


I believe that the block allows the cilk_sync statement to know which threads to sync with when it runs. Without the block id, the cilk_sync statement wouldn't know which threads it actually had to wait for to complete.


This greedy policy, when completed, changes the main thread to the thread that completes last. This behaviour seems weird, since most UI applications run UI on main thread. If this behaviour is true, then whenever a multi-threaded operation is completed, the main thread may be changed to some thread other than the initiating thread. Why not just let the thread that completes last to notify the initiating thread to continue?


@arcticx. i think the reason to choose change main thread has something to do with our choice at this slide. Since it is more 'efficient' to generate new threads recursively, we might need to change main thread to make that possible.

but i am not very sure why recursive approach is better than the other one on that slide. one advantage i can think of is recursive approach can spawn more threads quickly, and make fully use of all threads.