work stealing algorithm [closed]

自古美人都是妖i 提交于 2019-11-29 23:24:40

I recently read that paper, which describes a Java Fork / Join framework with Work Stealing Algroithms found here

Taken from that paper, we start with this:

Result solve(Problem problem) {
    if (problem is small)
       directly solve problem
    else {
       split problem into independent parts
       fork new subtasks to solve each part
       join all subtasks
       compose result from subresults
    }
}

Those forked subtasks (line 2 in the else block) can recursively create more subtasks themself and thus fill up the working queues of the parallely working threads. If one thread finished and has nothing more to do, he can "steal" the work from the queue of another thread.

So much for short, for all the details I would suggest looking into the paper.

Pretty nice and easy-to-understand explanation of the Work Stealing algorithm you can find in the following Channel9 video: "Parallel Extensions: Inside the Task Parallel Going Deep" Duffy, Huseyin Yildiz, Daan Leijen, Stephen Toub, see from 00:44:00 (by Daan Leijen)

you could have a look at Intel TBB algorithm for task scheduler, it is using Work Stealing pattern. See https://software.intel.com/fr-fr/node/468190

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!