The Linux Timekeeping Architecture
Linux must carry on several time-related activities. For instance, the kernel periodically:
Updates the time elapsed since system startup.
Updates the time and date.
Determines, for every CPU, how long the current process has been running, and preempts it if it has exceeded the time allocated to it. The allocation of time slots (also called “quanta”) is discussed in Chapter 7.
Updates resource usage statistics.
Checks whether the interval of time associated with each software timer (see the later section "Software Timers and Delay Functions“) has elapsed.
Linux’s timekeeping architecture is the set of kernel data structures and functions related to the flow of time. Actually, 80 × 86-based multiprocessor machines have a timekeeping architecture that is slightly different from the timekeeping architecture of uniprocessor machines:
In a uniprocessor system, all time-keeping activities are triggered by interrupts raised by the global timer (either the Programmable Interval Timer or the High Precision Event Timer).
In a multiprocessor system, all general activities (such as handling of software timers) are triggered by the interrupts raised by the global timer, while CPU-specific activities (such as monitoring the execution time of the currently running process) are triggered by the interrupts raised by the local APIC timer.
Unfortunately, the distinction between the two cases is somewhat blurred. For instance, some early SMP systems based on Intel 80486 ...
Get Understanding the Linux Kernel, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.