-1

I logged into a server with multiprocessors and started 20 python programs, each processing part of my data.

However, it cost too much time so I checked top and found all ipython processes are in sleeping. What's wrong?

$ top -u calc

top - 13:36:27 up 31 days,  4:48,  1 user,  load average: 0.13, 0.21, 0.20
Tasks: 335 total,   1 running, 334 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni, 99.9 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
KiB Mem:  66003900 total, 11998508 used, 54005392 free,   694584 buffers
KiB Swap:        0 total,        0 used,        0 free,  3192728 cached

   PID USER      PR  NI  VIRT  RES  SHR S  %CPU %MEM    TIME+  COMMAND                                       
105953 calc      20   0 13676 1568  980 R     1  0.0   1:04.91 top                                           
 92380 calc      20   0  507m 107m  18m S     0  0.2 248:47.52 ipython                                       
 92379 calc      20   0  507m 108m  18m S     0  0.2 244:19.90 ipython                                       
 92378 calc      20   0  510m 111m  18m S     0  0.2 257:01.33 ipython                                       
 92377 calc      20   0  510m 110m  18m S     0  0.2 252:13.59 ipython                                       
 92376 calc      20   0  514m 114m  18m S     0  0.2 247:35.26 ipython                                       
 92375 calc      20   0  503m 104m  18m S     0  0.2 222:48.84 ipython                                       
 92374 calc      20   0  514m 114m  18m S     0  0.2 247:16.59 ipython                                       
 92373 calc      20   0  508m 108m  18m S     0  0.2 252:58.08 ipython                                       
 92372 calc      20   0  516m 116m  18m S     0  0.2 241:42.16 ipython                                       
 92364 calc      20   0  511m 110m  18m S     0  0.2 229:59.30 ipython                                       
 92363 calc      20   0  507m 107m  18m S     0  0.2 255:22.32 ipython                                       
 92362 calc      20   0  516m 116m  18m S     0  0.2 238:59.80 ipython                                       
 92361 calc      20   0  506m 107m  18m S     0  0.2 253:45.55 ipython                                       
 92360 calc      20   0  510m 110m  18m S     0  0.2 250:11.67 ipython                                       
 92359 calc      20   0  507m 108m  18m S     0  0.2 240:12.78 ipython                                       
 88737 calc      20   0 12832 5192 1568 S     0  0.0   0:00.16 bash                                          
 88735 calc      20   0  9248 1340 1120 S     0  0.0   0:00.00 bash  

Some info about the CPUs:

$ grep 'physical id' /proc/cpuinfo|sort -u|wc -l

outputs 2

grep 'core id' /proc/cpuinfo|sort -u|wc -l

outputs 10

grep 'processor' /proc/cpuinfo|sort -u|wc -l

output 40

Lee
  • 101

1 Answers1

1

You only have a snapshot view of the system and at that specific moment your processes are all in the 'S' state. This is what the 'S' state means

S interruptible sleep (waiting for an event to complete)

If you look at the TIME+ column you can see that all of the processes are consuming CPU time and they have broadly speaking consumed the same amount.

This kinda looks normal to me.


What causes a process to go into the'S' state ? Well lots of things really, commonly I/O, waiting for semaphores etc.

If you really care you can use strace to attach to a process and see what it's doing.

strace -p 92376

would trace your process 92376.

user9517
  • 114,104
  • 20
  • 206
  • 289
  • Ooooops, there is no `strace` on the server... I try first on my local PC. But in fact I stare at the screen for a moment, they continue to stay in sleep.... and they are supposed to be CPU heavy-load, but they occupy little CPU resource. – Lee Nov 12 '15 at 13:33