pengdu
pengdu

Reputation: 1351

why select leads to high cpu sys load?

  1. top: the cpu load of the process is 100%, and 90% sys
  2. strace: all the system calls are select
  3. select: select(11, [8, 10], NULL, NULL, {0, 10}) = 0 (Timeout), fd 8 and fd 10 are both fifo
  4. vmstat -n 5: the system cs and system in is very low
  5. linux: 2.6.16.60
  6. cpu: 4 cores, Intel(R) Xeon(R) CPU E5504 @ 2.00GHz

how to explain it? and i have changed the timeout of select to 1s, the cpu sys load changed to 85%, why?

have changed nfds of select to the highest fd plus one, still high cpu sys load



EDIT -- Problem solved

The bug has nothing to do with select, the third argument abstime of pthread_mutex_timedwait is absolute time, but i used relative time by mistake, which caused the high cpu sys load.

And why pthread_mutex_timedwait causes high cpu sys load, not high cpu usr load?
strace: only see select system call, no others

Upvotes: 0

Views: 3742

Answers (1)

Valeri Atamaniouk
Valeri Atamaniouk

Reputation: 5163

You may have a bad (disconnected) descriptor. Usually that is the main reason for such load on read select.

You may have data available, but never read it. Same situation.

You might do something really heavy between of select calls.

If your select always returns 0, then the problem is not in select call. Its elsewhere.

Upvotes: 0

Related Questions