For a multi-core system, do all cores typically receive a timer interrupt at the same time or is it staggered? And how is it staggered?
Currently in the FMTK OS all CPU cores are receiving a timer interrupt for scheduling. Instead of the timer interrupt being broadcast to all cores, it should be probably be staggered. I suspect there would be a lot of contention for the system lists with all cores processing the timer interrupt at the same time. Supporting staggered interrupts is probably a non-trivial modification to the interrupt controller. Instead of it having a broadcast as the destination core, it would need to be able to rotate the destination core. The timer interrupt would then need to happen N times as often.
Are multi-core timer interrupts staggered?
-
- Member
- Posts: 5881
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Are multi-core timer interrupts staggered?
The timer interrupts don't need to be staggered if the scheduler's response to the interrupts is staggered (i.e. only one core actually performs a task switch, the rest just increment/decrement a counter and resume the interrupted task).
At least on x86, every CPU has its own local timer that can be programmed independently of the others. You can stagger interrupts by programming each timer to tick at an offset relative to the others. You can reduce the number of interrupts by only enabling them when the CPU needs to be interrupted. This is especially important for idle cores, which aren't going to be very idle if they have to keep waking up to respond to a timer.
You can reduce contention by assigning per-core resources so most cores responding to the timer interrupt can avoid accessing shared resources.
At least on x86, every CPU has its own local timer that can be programmed independently of the others. You can stagger interrupts by programming each timer to tick at an offset relative to the others. You can reduce the number of interrupts by only enabling them when the CPU needs to be interrupted. This is especially important for idle cores, which aren't going to be very idle if they have to keep waking up to respond to a timer.
You can reduce contention by assigning per-core resources so most cores responding to the timer interrupt can avoid accessing shared resources.