Problems with top and CPU-usage for multi-threaded programs under 2.6

Kurt Hansen khansen at charityweb.net
Thu Jun 2 18:11:26 UTC 2005


Alex Greg wrote:

>It seems that under the 2.6 kernel (Fedora Core 3), top doesn't show
>the CPU usage for multi-threaded programs properly. It appears to show
>the correct CPU usage for the main program, but it doesn't show the
>CPU for the threads of this program.
>
>
>This is fine for some programs where the main program is the one that
>does the CPU-intensive operations, but for some of our in-house Java
>programs, the main program doesn't do anything CPU-wise, but instead
>the CPU-intensive operations are done by separate threads.
>
>
>In this situation, top incorrectly reports the CPU usage of the
>program as 0% - this makes it very confusing when running top on the
>machine to find out where all the CPU is being used!
>  
>
I noticed a change in how top measured shared memory going from 2.6.8 to 
2.6.10. Specifically, I was looking at the size of Apache children in a 
mod_perl environment. The amount of MEASURED shared memory dropped 
significantly from 2.6.8 to 2.6.10.

This was discussed on the mod_perl list a few months back. I didn't 
quite follow all the details, but what I got from it was that it takes 
up too many resources for the kernel to keep track of how much shared 
memory is used by each process. For now and the foreseeable future, this 
is now a design choice for the kernel.

I suspect that is what you are seeing with the threads.

Take care,

Kurt Hansen
khansen at charityweb.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3190 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20050602/dbb23eb7/attachment-0001.bin>


More information about the fedora-list mailing list