A question about top command in Linux

plarq

Crazy forever
Joined
May 16, 2004
Messages
6,172
Location
None of the above
In a computer with 8 cores (2 quad core CPU, no HT) I run 6 physics simulation programs. The system gave me a 40% idle report in top (not very accurate).

Cpu(s): 59.0% us, 0.2% sy, 0.0% ni, 40.2% id, 0.5% wa, 0.0% hi, 0.0% si

Then I tried to overload the system with more simulation programs. I run another 4. Now the system is overloaded with tasks, but top command still returns 40% idle.

What's the problem with top? Did it update after a minute?

Edit: waited for several minutes, still 59.0% us

is it frozen?
 
Now I just move on to create a place holder script like this:

the.script:
Code:
if (number of user run programs is less than number of cores)
   run a program as a user
endif
This script is fine. It creates a new thread of program when system is idle, and do nothing when system is full.

However, I use this as a cron job:
Code:
su user -c the.script

After watching for a while, it overloads the system.

Edit: I found the problem. In cron mode, top is giving no information

Solved. It is top -b that makes top report things when running on cron and other background jobs.
 
Top Bottom