Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

When I issue $ top in linux, I get a result similar to this (see here).

One of the lines has CPU usage information represented like this:

Cpu(s): 87.3%us,  1.2%sy,  0.0%ni, 27.6%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st

While I know the definitions of each of them (far below), I don't understand what these tasks exactly mean...

  • hi - what does servicing hardware interrupts mean?
  • si - what does servicing software interrupts mean?
  • st - they say it's the time in involuntary wait by virtual cpu while hypervisor is servicing another processor (or) Time stolen from a virtual machine. But what does it actually mean? can someone be more clear?

{I listed all (us, sy, ni etc) because it would help others searching for the same. This information is not in the man pages.}

us: user cpu time (or) % CPU time spent in user space
sy: system cpu time (or) % CPU time spent in kernel space
ni: user nice cpu time (or) % CPU time spent on low priority processes
id: idle cpu time (or) % CPU time spent idle
wa: io wait cpu time (or) % CPU time spent in wait (on disk)
hi: hardware irq (or) % CPU time spent servicing/handling hardware interrupts
si: software irq (or) % CPU time spent servicing/handling software interrupts
st: steal time - - % CPU time in involuntary wait by virtual cpu while hypervisor is servicing another processor (or) % CPU time stolen from a virtual machine
share|improve this question

1 Answer 1

up vote 28 down vote accepted

hi is the time spent processing hardware interrupts. Hardware interrupts are generated by hardware devices (network cards, keyboard controller, external timer, hardware senors, ...) when they need to signal something to the CPU (data has arrived for example).

Since these can happen very frequently, and since they essentially block the current CPU while they are running, kernel hardware interrupt handlers are written to be as fast and simple as possible.

If long or complex processing needs to be done, these tasks are deferred using a mechanism call softirqs. These are scheduled independently, can run on any CPU, can even run concurrently (non of that is true of hardware interrupt handlers).

The part about hard IRQs blocking the current CPU, and the part about softirqs being able to run anywhere are not exactly correct, there can be limitations, and some hard IRQs can interrupt others.

(As an example, a "data received" hardware interrupt from a network card could simply store the information "card ethX needs to be serviced" somewhere and schedule a softirq. The softirq would be the thing that triggers the actual packet routing.)

si represents the time spent in these softirqs.

A good read about the softirq mechanism (with a bit of history too) is Matthew Wilcox's I'll Do It Later: Softirqs, Tasklets, Bottom Halves, Task Queues, Work Queues and Timers (PDF, 64k).

st, "steal time", is only relevant in virtualized environments. It represents time when the real CPU was not available to the current virtual machine - it was "stolen" from that VM by the hypervisor (either to run another VM, or for its own needs).

The CPU time accounting document from IBM has more information about steal time, and CPU accounting in virtualized environments. (It's aimed at zSeries type hardware, but the general idea is the same for most platforms.)

share|improve this answer
    
very clear. So, if I connect a new sound system, headset etc (any hardware for that matter) it also causes a hardware interrupt, right? –  its_me Aug 17 '11 at 19:14
1  
Yes, that could be a way for your sound chipset to signal that "something happened". But plugging in a headset might be dealt entirely by the sound chip itself (re-routing the sound output from the main out to your headphones for instance), so it might not generate an interrupt to the main CPU. Typing a key on your keyboard will generate interrupts though (from your USB hub device if you have an USB keyboard). See also cat /proc/interrupts (man man proc for doc. about that file). –  Mat Aug 17 '11 at 19:22

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.