Updating System Statistics
The kernel, among the other time-related duties, must periodically collect several data used to:
Checking the CPU resource limit of the running processes
Computing the average system load
Profiling the kernel code
Checking the Current Process CPU Resource Limit
update_process_times( ) function (invoked by
either the PIT’s timer interrupt handler on
uniprocessor systems or the local timer interrupt handler in
multiprocessor systems) updates some kernel statistics stored in the
kstat variable of type
kernel_stat; it then invokes
update_one_process( ) to update some fields
storing statistics that can be exported to user programs through the
times( ) system call. In particular, a distinction
is made between CPU time spent in User Mode and in Kernel Mode. The
function performs the following actions:
current’s process descriptor, which stores the number of ticks during which the process has been running in User Mode.
current’s process descriptor, which stores the number of ticks during which the process has been running in Kernel Mode.
do_process_times( ), which checks whether the total CPU time limit has been reached; if so, it sends
current. Section 3.2.5 describes how the limit is controlled by the
rlim[RLIMIT_CPU].rlim_curfield of each process descriptor.
Two additional fields called
times.tms_cstime are provided in the process ...