[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: system monitor information



On Mon, Sep 07, 2009 at 04:51:10PM -0500, Ron Johnson wrote:
> On 2009-09-07 16:31, ChadDavis wrote:
>> I'm using the gnome-system-monitor to watch some apps and their
>> resource usage.  On the process view, it lists a %CPU column.  I
>> assume this means the percentage of the CPU that the application is
>> currently using.  THe documentation doesn't really clarify this, but
>> seems not to contradict this interpretation.
>>
>> The app I'm watching frequently hits 40-60 percent CPU usage.  My
>> question is about interpreting this.  I'm testing on a Core2 Duo
>> machine.  My understanding of computer architecture is not great, but
>> not trivial.  Here's what I'm thinking.  If one cpu is idle, and an
>> app gets to run, it's going to get 100% of the cpu, correct?  Even if
>> it's only executing a 100 instructions, if there's no contention for
>> the CPU, the app will have 100% of the CPU for however small of an
>> interval it takes to execute those instructions, correct?  I'm
>> certainly not familiar with the linux internals of my debian system
>> enough
>
> *When it's running*, it gets 100% of a CPU.
>
> But on a multiprocessing, multiuser computer, where other processes and 
> the OS are competing for time, your app only gets full use of the CPU for 
> a few milliseconds and then the OS takes it away and gives it to another 
> process.  Also, when your app is waiting on IO (from disk, network, 
> keyboard, etc) it's not doing anything.
>
> So, that 40-60% seems right.
>
> If you want to see the CPU burn, try this simple Python script:
>
> ###  BEGIN
> i = -2 * 10**9

Why this strange value?

> while 1: i = i + 1
>
> ###  END
>
> (Note the extra <Enter> you must press after the 2nd line!)

Any simple endless loop will do. E.g. the floolwing in the shell:

  while :; do :; done

Note that it makes the shell itself the hog process.

-- 
Tzafrir Cohen         | tzafrir@jabber.org | VIM is
http://tzafrir.org.il |                    | a Mutt's
tzafrir@cohens.org.il |                    |  best
ICQ# 16849754         |                    | friend


Reply to: