I was trying to gain a theoretical knowledge on the Linux scheduler in 2.6 by reading the Robert Love's Linux Kernel Development book and gazing through the sched.c code in the kernel. While having a conversation with a friend of mine, a question came up to which I wasn't sure about the exact answer. I looked through the code and read through the chapter again, but still am not sure about the right answer. The question is as follows:
Consider the following scenario.
1. disable the interrupts in the machine (local_irq_save)
2. wake up a process from a wait queue (wake_up or up() - which I thought ultimately calls wake_up).
3. enable interrupts
In step 2 above, when I wake up a process, if the woken up process has a higher priority than the process waking it up, the current process will be preempted. The new process scheduled need not have the interrupts disabled and hence that process could be interrupted which would make the whole disable interrupt concept fail.
I am assuming that the above does not happen in the kernel, but I do not understand how the kernel prevents this from happening because I do not see a preempt_disable () or anything like that being set either.
Any help in getting my basics straightened up is appreciated?
Thank you,
John V. George