1 |
> > according to man vmstat: |
2 |
> > |
3 |
> > System |
4 |
> > in: The number of interrupts per second, including the clock. |
5 |
> > cs: The number of context switches per second. |
6 |
> > |
7 |
> > 1) Does anyone have a "layman's" explaination of what interrupts and context switches are? |
8 |
> > |
9 |
> Interrupts are just that - signals that interrupt the CPU in whatever it |
10 |
> is doing and command it to do something else that needs to be done right |
11 |
> away. |
12 |
> There are two varieties: hardware and software. |
13 |
> The hardware type is invoked by an actual hardware signal on the CPU - |
14 |
> the system timer is one of these, but so is the keyboard :) |
15 |
> The software interrupts can be programmed by anyone, and are often used |
16 |
> as a handy shortcut to run a common task without a lot of overhead. |
17 |
> |
18 |
> A context switch is the CPU switching from one execution context to |
19 |
> another; task switches are context switches, but so are kernel system |
20 |
> calls from userspace programs. |
21 |
> Since the kernel runs in a different execution environment than all the |
22 |
> other processes, every switch from one to the other needs to save and |
23 |
> later restore the context of that process - stack space, registers, |
24 |
> flags, etc. |
25 |
> |
26 |
> So the two are sort of related: every interrupt that causes a kernel |
27 |
> function to be called (like the process scheduler), also causes a |
28 |
> context switch when it suspends it current task and resumes the next task. |
29 |
> |
30 |
> > 2) How high can these numbers be before a system admin should start to worry about |
31 |
> 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 |
Thanks! |
60 |
-- |
61 |
gentoo-server@g.o mailing list |