'top' output -> High CPU consumption when thread is in 'sleep' state

'top' output -> High CPU consumption when thread is in 'sleep' state

Post by Mohun Biswa » Sat, 16 Oct 2004 13:19:24




> The following is an excerpt from the 'top' output:
> ---------
>   PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
> 19828 tstUsr     25  47    4  899M   58M sleep   4:11 14.34%
> bin.execRun
> ---------

> The above state is after Thread.Sleep()(Java code) is invoked. I am
> just wondering, how the thread which is in 'sleep' state consumes so
> much i.e.14.34% of CPU.

> Could anybody clarify this?

Can't help directly, but 'top' is deprecated on Solaris nowadays in
favor of the built-in 'prstat' program which provides largely the same
output. Try that and see if it's perhaps a problem with top itself
rather than your system.

--
M.Biswas

 
 
 

'top' output -> High CPU consumption when thread is in 'sleep' state

Post by Fredrik Lundho » Sat, 16 Oct 2004 18:36:18




>The following is an excerpt from the 'top' output:
>---------
>  PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
>19828 tstUsr     25  47    4  899M   58M sleep   4:11 14.34%
>bin.execRun
>---------

>The above state is after Thread.Sleep()(Java code) is invoked. I am
>just wondering, how the thread which is in 'sleep' state consumes so
>much i.e.14.34% of CPU.

>Could anybody clarify this?

The CPU usager percent is not an instant snapshot rather an average over some
time back. Wait some more and watch the value lower over time.

/Fredrik

--
Fredrik Lundholm  


 
 
 

'top' output -> High CPU consumption when thread is in 'sleep' state

Post by Paul Lutu » Sat, 16 Oct 2004 12:33:47



> The following is an excerpt from the 'top' output:
> ---------
>   PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
> 19828 tstUsr     25  47    4  899M   58M sleep   4:11 14.34%
> bin.execRun
> ---------

> The above state is after Thread.Sleep()(Java code) is invoked. I am
> just wondering, how the thread which is in 'sleep' state consumes so
> much i.e.14.34% of CPU.

> Could anybody clarify this?

Something is wrong with your program or your system. You have not posted any
code or revealed your OS, so all one can do is conjecture in obvious ways.

I just created a dummy program that calls Thread.sleep(15000) and watched my
"top" output on Fedora Core 2, no CPU-hogging activity here.

Maybe you could provide some information?

--
Paul Lutus
http://www.arachnoid.com

 
 
 

'top' output -> High CPU consumption when thread is in 'sleep' state

Post by Darren Dunha » Sat, 16 Oct 2004 23:50:52



Quote:> The following is an excerpt from the 'top' output:
> ---------
>   PID USERNAME THR PRI NICE  SIZE   RES STATE   TIME    CPU COMMAND
> 19828 tstUsr     25  47    4  899M   58M sleep   4:11 14.34%
> bin.execRun
> ---------
> The above state is after Thread.Sleep()(Java code) is invoked. I am
> just wondering, how the thread which is in 'sleep' state consumes so
> much i.e.14.34% of CPU.

The state is a snapshot at one point in time.  The thread may have been
sleeping for a moment, but in general is running.

Also, the CPU time there is identical to the one in 'ps'.  It represents
what is basically a weighted average of CPU consuption over the previous
few seconds (not quite, but pretty close).

So the process could consume CPU for 30 seconds, then sleep for
something like 40 to 50 seconds and you'd get a sleeping process that
has a CPU figure of 14% or so.

--

Senior Technical Consultant         TAOS            http://www.taos.com/
Got some Dr Pepper?                           San Francisco, CA bay area
         < This line left intentionally blank to confuse you. >

 
 
 

1. Another report of mozilla in D state, related to the 'uninterruptible sleep' thread

Second time around, I didn't evoke any interest the first time.

I reported it back on Mar/27.  It is still an almost daily problem
requiring a reboot.  Mozilla gets stuck in down_write_failed.  This time
I'm sure it's not reiser's fault.

# uname -r
2.4.3-pre8

mozilla-bin  D C781849C     0 21055      1        (NOTLB)         20611
 Call Trace: [<ff000000>] [<ff000000>] [<ff000000>]
[leaf_copy_items+121/252]
   [leaf_paste_in_buffer+239/672] [leaf_cut_from_buffer+486/984]
   [leaf_cut_from_buffer+863/984] [balance_leaf+8645/9544]
   [balance_leaf+9225/9544] [leaf_item_bottle+916/1260]
   [balance_leaf+9505/9544] [balance_leaf+9225/9544]
   [leaf_item_bottle+916/1260] [balance_leaf+9505/9544] [<f0000000>]
   [bin_search_in_dir_item+58/196] [leaf_copy_items+121/252]
   [leaf_paste_in_buffer+239/672] [<d086f044>]
   [flush_commit_list+66/908] [flush_journal_list+531/944]
   [free_list_bitmaps+30/60] [reiserfs_unlink+167/460]
   [posix_lock_file+526/1232] [empty_bad_page+3213/4096]
   [empty_bad_page+2717/4096] [fib_flag_trans+35/60]
   [empty_bad_pte_table+3363/4096]

If someone is actually interested, it'd be neat to get this fixed.

-d

--
  There is a natural aristocracy among men. The grounds of this are virtue and talents. Thomas Jefferson
  The good thing about standards is that there are so many to choose from. Andrew S. Tanenbaum

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

2. KDE 2.1.2, XFree86 4.1.0

3. ksh ': >a >b' -vs- '>a >b' re speed

4. eth0: Transmit error, Tx status register 82.

5. Limiting 'w', 'top' and 'ps'

6. WWW-Portal?

7. Odd 'w', 'who' and 'tty' output

8. Socket Programming - Multiple Network Cards

9. State 'D' / uninterruptible sleep

10. What's 'side effects' of Ksh built-ins?

11. Why does 'ls' give '/' as the output?

12. How to 'flush' output of 'C' cgi-program

13. SIGFPE with 'top' or 'ps -u' -- why ???