系列文章:https://blog.csdn.net/Vince_/article/details/89054330
调度的入口
Timer interrupt is responsible for decrementing the running process’s timeslice count.When the count reaches zero, need_resched is set and the kernel runs the scheduler as soon as possible
在时钟中断中更新进程执行时间信息,如果时间片用完,则设置need_resched,在接下来的调度过程中换出正在执行的进程。
RTC(Real-Time Clock)
实时时钟,非易失性设备存储系统时间,在系统启动时,通过COMS连接设备到系统,读取对应的时间信息提供给系统设置。
System Timer
系统定时器由电子时钟以可编程频率实现,驱动系统时钟中断定期发生,也有部分架构通过减法器decrementer实现,通过计数器设定初始值,以固定频率减少直到为0,然后出发时钟中断。
The timer interrupt is broken into two pieces: an architecture-dependent and an architecture-independent
routine.
The architecture-dependent routine is registered as the interrupt handler for the system
timer and, thus, runs when the timer interrupt hits. Its exact job depends on the
given architecture, of course, but most handlers perform at least the following work:
1. Obtain the xtime_lock lock, which protects access to jiffies_64 and the wall
time value, xtime.
2. Acknowledge or reset the system timer as required.
3. Periodically save the updated wall time to the real time clock.
4. Call the architecture-independent timer routine, tick_periodic().
The architecture-independent routine, tick_periodic(), performs much more work:
1. Increment the jiffies_64 count by one. (This is safe, even on 32-bit architectures,
because the xtime_lock lock was previously obtained.)
2. Update resource usages, such as consumed system and user time, for the currently
running process.
3. Run any dynamic timers that have expired (discussed in the following section).
4. Execute scheduler_tick(), as discussed in Chapter 4.
5. Update the wall time, which is stored in xtime.
6. Calculate the infamous load average.