Why dont the System and User measures of CPU usage give the same number? Surely theyre measuring the same thing?
Most
operating systems give measures of CPU
(and other resource) usage from the point
of view of the system as a whole, and
also from the point of view of the workload
that runs on it. Since the "workload" is what causes the "system" to
be busy, you would expect them to be
the same. However, that's not the whole
story.
Firstly, there are always some system activities
that don't really belong to any workload.
A good example of this is scheduling - the
process that the operating system carries
out to determine which of several candidate
tasks to run next. Other system costs that
cannot be charged to any workload include
interrupt handling. Although an I/O may
have been carried out for a particular user
task, the operating system has to carry
out some low-level processing of the I/O
interrupt before it can determine its destination.
Secondly, particularly
in UNIX systems, there is a problem with
the level of detail that can be recorded
for user tasks. Most UNIX implementations
account for user CPU time in multiples
of one hundredth of a second. Any task
which uses less than that amount of CPU
time may not get "noticed".
A hundredth of a second may not sound like
much, but if these very short tasks run
millions of times per day there can be
a very large shortfall indeed.
The bottom line
is: trust the system measurements rather
than the "user" or "accounting" measurements.
Next
modeling Tip |