anup.stackoverflow anup.stackoverflow - 5 months ago 19
Linux Question

Linux Kernel Multicore Issue

I have some doubts regarding some linux kernel scheduling.

1) Does linux kernel(schedular to be specific) always runs on CPU-0?
2) One Scenario:
One kernel thread running on CPU - 0, goes into sleep with interrupts disabled.
In this case, will the schedular run on other CPU?
if Yes, how is the selection made out of the remaining core so as to which will run
the schedular, is this decision made while disabling interrupts on CPU - 0?

CL. CL.
Answer

The scheduler is just a piece of code (in particular, the schedule() function). Like most other parts of the kernel, it runs on whatever CPU it is called.

The scheduler gets called when some thread wants to sleep or after an interrupt has been handled; this can happen on all CPUs.

Comments