问题
I wanted to know if a copy of schedule() function runs on each processor, or is it just one schedule() running for each processor.
If there is a copy of schedule() running on each processor/core, how are the processes dispatched to a particular CPU/cpu runqueue. Is it the job of load balancer? Is there only one load balancer running for all CPU's or it is done in a distributed fashion using flags/communication method?
ps- I know the working of scheduling classes etc but I am having a hard time figuring out the distribution of processes among various runqueues.
回答1:
how are the processes dispatched to a particular CPU/cpu runqueue. Is it the job of load balancer?
Yes. In multi-processor system the load balancer periodically checks to see whether the CPU loads are unbalanced; if they are, the processor performs a cross-CPU balancing of tasks.
Is there only one load balancer running for all CPU's or it is done in a distributed fashion using flags/communication method?
Yes. In SMP scheduling there is only one schedule() and one load balancing that manage multitasking between multiple cores.
Refer: Inside the Linux scheduler.
来源:https://stackoverflow.com/questions/14811175/linux-scheduler-on-numa-and-smp