Richard Broersma Jr wrote:
according to man vmstat:
System
in: The number of interrupts per second, including the clock.
cs: The number of context switches per second.
1) Does anyone have a "layman's" explaination of what interrupts and context
switches are?
Interrupts are just that - signals that interrupt the CPU in whatever it
is doing and command it to do something else that needs to be done right
away.
There are two varieties: hardware and software.
The hardware type is invoked by an actual hardware signal on the CPU -
the system timer is one of these, but so is the keyboard :)
The software interrupts can be programmed by anyone, and are often used
as a handy shortcut to run a common task without a lot of overhead.
A context switch is the CPU switching from one execution context to
another; task switches are context switches, but so are kernel system
calls from userspace programs.
Since the kernel runs in a different execution environment than all the
other processes, every switch from one to the other needs to save and
later restore the context of that process - stack space, registers,
flags, etc.
So the two are sort of related: every interrupt that causes a kernel
function to be called (like the process scheduler), also causes a
context switch when it suspends it current task and resumes the next task.
2) How high can these numbers be before a system admin should start to worry
about preformance?
Erm... they don't have much to do with performance, they just happen; if
they didn't, you wouldn't have a working system...
Just FYI: the 2.6 kernel uses a 1000Hz timer for the process scheduler,
so expect to see at least 1000 interrupts per second no matter what else
your system is doing.
If the number drops much *lower* than this, you might have a performance
problem: the CPU can't keep up with your tasks.
Same goes for context switches: the busier it is, the more switches will
have to take place, except this need not happen on every interrupt -
only when a task actually needs to be executed.
3) what are the options to reduce these number?
Stop using your computer.
Seriously :)
If you really want to know what is going on , I suggest you start using
_dstat_ instead of vmstat - it offers more information and will also
help to correlate between the different numbers, e.g. an increase in
disk or network activity will also show an increase in interrupts, and a
maxed-out disk subsystem will show up as a higher system CPU percentage
than normal.
But apart from the pretty nifty info you can get from dstat, don't worry
about the values; it's just not that important.
The disk and cpu usage are much more informative in that respect.
J
--
[email protected] mailing list