what Linux does in the timer interrupt?
I take this as asking for the in-between actions.
I copy from that __schedule()
:
* 3. Wakeups don't really cause entry into schedule(). They add a
* task to the run-queue and that's it.
*
* Now, if the new task added to the run-queue preempts the current
* task, then the wakeup sets TIF_NEED_RESCHED and schedule() gets
* called on the nearest possible occasion:
This is a good starting point; it is well documented. This is the start of a long story. What is a "wakeup"? Is it about R and S states? and blocking?
I have only one slight objection to S.K.'s answer, and to one of the links: about HZ being "not so important anymore".
Can be because there was some confusion in the past, some overcorrection from 100HZ to 1000HZ then back to 300HZ, so to fit "multimedia" at the same time (think of HPET origin 2005: "multimedia timer").
Can be with 4 and more cores it also matters less. But depending on what you want to do with your "server" it still should matter - this latency / throughput trade-off can be important under heavy load.
And if the scheduling is not done in the timer interrupts, then it is done in these "other" interrupts.
And why is HZ not configurable (boot or even runtime)?