Why does the xv6 scheduler call sti () at the start of each loop?

The accompanying book says:

The reason for interrupts to be turned on periodically while idling the CPU is that there can be no RUNNABLE process since processes (such as the shell) are waiting for I / O; if the scheduler left interrupts, disabled all the time, I / O will never come.

But it seems to me we just need to call sti () once before the outter for-loop, since every time we release ptable.lock, interrupts are re-enabled.

+3


source to share


1 answer


It is possible that it schedule()

is called with interrupts disabled, in which case releasing the ptable spinlock will not reuse them.



+1


source







All Articles