0

工作窃取是用户级线程的常用策略。每个进程都有一个工作队列来拿工作,当他们没有工作要做时,会从其他人的队列中窃取。

是否有任何内核为内核级线程实现这种策略?如果不是,原因是什么?

我相信在 Linux 中,内核级线程中有一个线程迁移的概念,它将线程从高负载处理器迁移到低负载处理器,但这似乎是一种不同的算法。但如果我错了,请纠正我。

谢谢

4

1 回答 1

1

The work stealing scheduler is a parallel computation scheduler. It is usually on user level libraries (like Intel tbb: https://www.threadingbuildingblocks.org/) or even languages like Cilk (https://software.intel.com/en-us/intel-cilk-plus)

Kernel-level threads are scheduled by the operating system, and as so the scheduling techniques are quite different. For instance, in work-stealing scheduler, one of the objectives is to limit memory usage (as proven in the original paper: http://supertech.csail.mit.edu/papers/steal.pdf) and to achieve that the threads are stored in a deque. However, in operating system's schedulers the main objective is to be fair between the users, give each process/kernel thread a fair amount of time to run (as max-min fairness states: http://en.wikipedia.org/wiki/Max-min_fairness), etc. Operating System's schedulers even use different priorities among kernel threads/processes (please see http://en.wikipedia.org/wiki/Completely_Fair_Scheduler or http://en.wikipedia.org/wiki/Multilevel_feedback_queue). For that reason, work stealing implementations are made in user-level, since their objective is to schedule user-level threads inside a process and not kernel-threads.

于 2015-04-17T20:13:18.040 回答