Why do we need per-CPU schedulers and separate their context from that of the process's kernel threads?

43 Views Asked by At

The xv6 (a teaching os kernel developed at MIT) kernel's documentation states, 'Every xv6 process has its own kernel stack and register set. Each CPU has a separate scheduler thread for use when it is executing the scheduler rather than any process’s kernel thread.' However, why do we need per-CPU schedulers and separate their context from that of the process's kernel threads?

It seems to be a good idea in systems with distributed per-core process tables, in which case you wouldn’t want any core to wake up and continue running a process's kernel thread that was in the middle of traversing/ modifying the process table of another core. However, I don’t understand how this helps in xv6, where there is only one process table shared by all cores. Also, enabling interrupts within the scheduler, which has a stack set up during boot time with limited space, could risk overflowing the stack. Is it advisable to completely disable timer interrupts while inside the scheduler?

0

There are 0 best solutions below