Question

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?
Was it helpful?

Solution

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.

OTHER TIPS

1) Does linux kernel(schedular to be specific) always runs on CPU-0? (No, scheduler can runs on any CPU cores.)

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? (A thread running on CPU -0, goes into sleep. Which means the thread quits the CPU voluntarily.The sleep code will call linux scheduler, and the scheduler will choose another thread/process to run.This is noting to do with the interrupts.Disabling the interrupts(eg. timer interrupt), can stop the thread being interrupted and scheduled out to the CPU against its will.)

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?

(Hope this helps!)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top