Should each CPU's Local APIC timer interrupt at different phase?
Posted: Wed Apr 15, 2026 6:26 am
I'm thinking about APIC timer interrupt on SMP hardware, is it worthy to make timer of each CPU fire at different time?
Let me explain, say we have 4 CPUs, and system clock rate is 1Hz, so:
I think we can use an external reference clock source (like PIT or HPET) to setup. Set reference clock frequency at (sys_main_freq*cpu_count), like 4Hz in previous example, and broadcast this interrupt to all CPU (via IOAPIC). Start the reference clock, each CPU skips first X interrupt (where X is the CPU-index), and start its APIC timer. After the last CPU done, stop the reference clock, and resyncing finish.
What's your idea? Do you know any other OS have similar design?
Let me explain, say we have 4 CPUs, and system clock rate is 1Hz, so:
- 0s 000ms, CPU 0 timer interrupt!
- 0s 250ms, CPU 1 timer interrupt!
- 0s 500ms, CPU 2 timer interrupt!
- 0s 750ms, CPU 3 timer interrupt!
- 1s 000ms, CPU 0 timer interrupt!
- 1s 250ms, CPU 1 timer interrupt!
- ...you get the idea
I think we can use an external reference clock source (like PIT or HPET) to setup. Set reference clock frequency at (sys_main_freq*cpu_count), like 4Hz in previous example, and broadcast this interrupt to all CPU (via IOAPIC). Start the reference clock, each CPU skips first X interrupt (where X is the CPU-index), and start its APIC timer. After the last CPU done, stop the reference clock, and resyncing finish.
What's your idea? Do you know any other OS have similar design?