Previous | Next --- Slide 53 of 62
Back to Lecture Thumbnails
rahulahoop

This was a nice set of slides from Kayvon. I was initially confused about why we would want a worker queue for each thread, where having a single task queue for all threads seems conceptually simpler than all of this "stealing" business.

The single shared descriptor depicted here is nice because it reduces the overhead that comes from having to synchronize threads. Unlike with a single shared task queue, these threads, which use individual queues, don't have to be constantly communicating with one another to grab more work. Threads only have to synchronize when they are idle and their queue is empty, or when updating the descriptor.

pranil

You're right, thanks for the additional insight in your second paragraph!

Another point I thought about when this was discussed in class was this: it is beneficial for each thread to maintain its own separate work queue to benefit from data locality. Remember that whenever any thread becomes idle, it begins working on the newest task in its own work queue. This was exemplified in the quicksort recursion illustrated.

Please log in to leave a comment.