1 |
Richard Broersma Jr wrote: |
2 |
> according to man vmstat: |
3 |
> |
4 |
> System |
5 |
> in: The number of interrupts per second, including the clock. |
6 |
> cs: The number of context switches per second. |
7 |
> |
8 |
> 1) Does anyone have a "layman's" explaination of what interrupts and context switches are? |
9 |
> |
10 |
Interrupts are just that - signals that interrupt the CPU in whatever it |
11 |
is doing and command it to do something else that needs to be done right |
12 |
away. |
13 |
There are two varieties: hardware and software. |
14 |
The hardware type is invoked by an actual hardware signal on the CPU - |
15 |
the system timer is one of these, but so is the keyboard :) |
16 |
The software interrupts can be programmed by anyone, and are often used |
17 |
as a handy shortcut to run a common task without a lot of overhead. |
18 |
|
19 |
A context switch is the CPU switching from one execution context to |
20 |
another; task switches are context switches, but so are kernel system |
21 |
calls from userspace programs. |
22 |
Since the kernel runs in a different execution environment than all the |
23 |
other processes, every switch from one to the other needs to save and |
24 |
later restore the context of that process - stack space, registers, |
25 |
flags, etc. |
26 |
|
27 |
So the two are sort of related: every interrupt that causes a kernel |
28 |
function to be called (like the process scheduler), also causes a |
29 |
context switch when it suspends it current task and resumes the next task. |
30 |
|
31 |
> 2) How high can these numbers be before a system admin should start to worry about preformance? |
32 |
> |
33 |
Erm... they don't have much to do with performance, they just happen; if |
34 |
they didn't, you wouldn't have a working system... |
35 |
Just FYI: the 2.6 kernel uses a 1000Hz timer for the process scheduler, |
36 |
so expect to see at least 1000 interrupts per second no matter what else |
37 |
your system is doing. |
38 |
If the number drops much *lower* than this, you might have a performance |
39 |
problem: the CPU can't keep up with your tasks. |
40 |
Same goes for context switches: the busier it is, the more switches will |
41 |
have to take place, except this need not happen on every interrupt - |
42 |
only when a task actually needs to be executed. |
43 |
> 3) what are the options to reduce these number? |
44 |
> |
45 |
Stop using your computer. |
46 |
Seriously :) |
47 |
|
48 |
If you really want to know what is going on , I suggest you start using |
49 |
_dstat_ instead of vmstat - it offers more information and will also |
50 |
help to correlate between the different numbers, e.g. an increase in |
51 |
disk or network activity will also show an increase in interrupts, and a |
52 |
maxed-out disk subsystem will show up as a higher system CPU percentage |
53 |
than normal. |
54 |
|
55 |
But apart from the pretty nifty info you can get from dstat, don't worry |
56 |
about the values; it's just not that important. |
57 |
The disk and cpu usage are much more informative in that respect. |
58 |
|
59 |
J |
60 |
|
61 |
-- |
62 |
gentoo-server@g.o mailing list |