I assume your question is basically "What's going on here?".
I will answer by explaining your output - If that helps, let me know, I'd add more detail.
(Try to edit the question so that is's more clear what you are asking, otherwise it may get closed)
So, yes, you see "huge CPU load due to high CPU usage"!
Let's look at the top output:
Cpu(s): 10.5%us, 89.2%sy, 0.0%ni, 0.0%id, 0.0%wa, 0.0%hi, 0.3%si, 0.0%st
The percentage values say where the time is spent - in user code, or in system (kernel) code. The %sy
are the time in system code - and there are additional 10%us - user time. So the CPU is used by 100%! (You can see it from the 0%id - idle - also.)
But there is even more:
Tasks: 747 total, 176 running, 560 sleeping, 0 stopped, 11 zombie
There are 176 running processes. But if you have less than 176 cores, some of them are olny in the state that they could run if they had CPU time.
That means you have more load, that could get more CPUs to 100% usage.
Your CPU is not used to 89.2% - it's 100%
From this, there is no reason to look at iostat
- the system does not need much IO in this state.
But the information we need it: what are these at least 176 processes or threads, there may be many more similar tasks not in running state.
And the next will be: what are they doing, and why?
So take a look at the process list in top
- it may show some obvious problem.
It could help to know more about the processes in "runable" state;
The command below lists all processes and threads that are in "runable" state - the tasks that could run if they get CPU time:
ps -o comm,pid,ppid,user,time,etime,start,pcpu,state --sort=comm aH | grep '^COMMAND\|R$'
For me, that lists only one or two lines, including ps
itself
top -M
sorts by resident memory usage.
M
sort tasks by resident memory usage.
This is the version of top on my system.
top -v
top: procps version 3.2.7
If your Linux distribution supports the -M
flag, you could use it as mentioned here.
However, if your top
doesn't support the -M
flag, you could launch your top
command and get into the interactive mode by typing h to check the sort field. (I assume it is the same across various distributions)
In my system (rather the top
version of my system), I could type F or O to select the sorting field and key Q of my top
version lets me sort on resident memory.
If you want to save your configuration you could do something as mentioned by slm here.
Saving configuration
You can use the Shift+W to save your changes so they're the defaults:
W Write configuration file
The file is stored here, $HOME/.toprc
, and looks like this:
$ more .toprc
RCfile for "top with windows" # shameless braggin'
Id:a, Mode_altscr=0, Mode_irixps=1, Delay_time=1.000, Curwin=2
Def fieldscur=AEHIoqTWKNMBcdfgjpLrsuvyzX
winflags=129016, sortindx=19, maxtasks=0
summclr=2, msgsclr=5, headclr=7, taskclr=7
Job fieldscur=ABcefgjlrstuvyzMKNHIWOPQDX
winflags=63416, sortindx=13, maxtasks=0
summclr=6, msgsclr=6, headclr=7, taskclr=6
Mem fieldscur=ANOPQRSTUVbcdefgjlmyzWHIKX
winflags=65464, sortindx=13, maxtasks=0
summclr=5, msgsclr=5, headclr=4, taskclr=5
Usr fieldscur=ABDECGfhijlopqrstuvyzMKNWX
winflags=65464, sortindx=12, maxtasks=0
summclr=3, msgsclr=3, headclr=2, taskclr=7
See section 5 of the man page for more details, "5. FILES".
Best Answer
You can change the sort field in the interactive
top
window with the < and > keys. I'm not sure what operating system you're running but at least on my GNU top, k is supposed to kill, not reset.Presumably, your friend changed the sort field and hit Shift+W to save to
~/.toprc
. Just use the keys I mentioned to choose the sort field you want and then, when it's set up as you like it, hit Shift+W again and it should save that state and open that way next time.