Previous | Next --- Slide 59 of 62
Back to Lecture Thumbnails
apappu

Here -- say thread 2 pops the continuation off its work queue, sees that spawn == done, and continues running. What do thread 0 and thread 1 do at this point when they are put back onto the processor? I feel like there is an issue with synchronizing such that only one thread continues executing after seeing spawn == done?

sirej

When spawn == done, there are no more tasks that can be possibly be run in parallel -- the only thing left at the moment is the continuation. Thread 2 would pop the continuation off of the queue and all queues would be empty. So, thread 0 and thread 1 would just be waiting at that point.

alexder

I'm curious how the thread work queue data structure is implemented. On the one hand, it's rather straightforward that you need various queues to keep track of the work to do. But should we also be concerned about data races? what if two threads are accessing the position in memory where the work thread is at the same time? could this lead to stalls?

Please log in to leave a comment.