4

I see that the htop command reports respective the % of utilisation of each CPU core and also that of the processes.

We know that only 1 process can execute at a time in the CPU. How is it possible for processes to occupy a certain "Percentage" of the CPU ?

Does it have anything to do with the Instruction Pipeline ?

  • it's percentage of CPU time that htop is showing – oawuie Jul 9 '14 at 17:48
  • Nothing to do with pipeline. – ctrl-alt-delor Jul 9 '14 at 17:49
3

Top shows usage over some time period - by default, something like 3 seconds. It basically tells you what percentage of CPU time a particular process ID used over that interval. And note that this percentage can be over 100% - if you had one process running two threads and keeping both cores of a dual core system busy, you'd see a number around 195% in the %CPU column for that process.

To add some more detail, as the man page explains:

       k: %CPU  --  CPU usage
          The task's share of the elapsed  CPU  time  since  the  last  screen
          update,  expressed as a percentage of total CPU time.  In a true SMP
          environment, if 'Irix mode' is Off, top  will  operate  in  'Solaris
          mode'  where  a task's cpu usage will be divided by the total number
          of CPUs.  You toggle 'Irix/Solaris' modes with the  'I'  interactive
          command.
...
       -d : Delay time interval as:  -d ss.tt (seconds.tenths)
            Specifies the delay between screen updates, and overrides the cor-
            responding value in  one's  personal  configuration  file  or  the
            startup  default.   Later  this can be changed with the 'd' or 's'
            interactive commands.
...
           Global_defaults
              'A' - Alt display      Off (full-screen)
            * 'd' - Delay time       3.0 seconds
              'I' - Irix mode        On  (no, 'solaris' smp)
            * 'p' - PID monitoring   Off
            * 's' - Secure mode      Off (unsecured)
              'B' - Bold disable     Off

So the %CPU column is the percentage of the machine's total CPU time since the last screen update. You can change the time between screen updates either at the command line or interactively, but it defaults to 3 seconds. By default, Irix mode is enabled and the %CPU can be >100% on a multiprocessor system, but Irix mode can be disabled to cause the percentages to be scaled down based on the number of cores.

  • Can you direct me to a reliable and simple article ? ( if you can, include it in the answer) . – kesari Jul 10 '14 at 13:37
  • @sssv96: Nothing's more reliable than the man page - I quoted some sections from it to elaborate on my explanation. – godlygeek Jul 10 '14 at 14:17
  • 1
    This is the man page of top. The definition of percentage of CPU of htop is maybe different. – Ortomala Lokni Aug 4 '15 at 20:44
0

It is statistics: 50% means “half of cpu over a time”, if you look deeper you can find what that time is.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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