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

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

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 charityweb net

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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