The kernel, among the other time-related duties, must periodically collect various data used for:
Checking the CPU resource limit of the running processes
Updating statistics about the local CPU workload
Computing the average system load
Profiling the kernel code
We have mentioned that the
update_process_times( ) function is
invoked—either by the global timer interrupt handler on uniprocessor
systems or by the local timer interrupt handler in multiprocessor
systems—to update some kernel statistics. This function performs the
Checks how long the current process has been running.
Depending on whether the current process was running in User Mode
or in Kernel Mode when the timer interrupt occurred, invokes
account_user_time( ) or
account_system_time( ). Each of
these functions performs essentially the following steps:
Updates either the
utime field (ticks spent in User
Mode) or the
(ticks spent in Kernel Mode) of the current process
descriptor. Two additional fields called
cstime are provided in the process
descriptor to count the number of CPU ticks spent by the
process children in User Mode and Kernel Mode, respectively.
For reasons of efficiency, these fields are not updated by
but rather when the parent process queries the state of one of
its children (see the section "Destroying
Processes" in Chapter 3).
Checks whether the total CPU time limit has been reached; ...