When daemon will hog cpu?
What are the possible condition might occur for daemon to hog the cpu 开发者_如何学编程and makes the system very slow or moved to non-responsive state?
Daemons have few threads as well.
A tiny fraction of reasons include:
- infinite loops in general
- low memory in general
- race conditions
- dead locks
- starvation
- spawning too many threads
- forking too much
- super low process priority
- infinite recursion
- algorithms of bad algorithmic complexity
- really slow operations on numbers
- something is repeated too often (e.g. a variable that is better calculated outside a loop which the compiler was unable to move out)
- cache-unfriendliness
- using sleep-like functions
- invoking slow functions
- running the daemon on a slow machine
- your are being DOS-attacked
- your machine is running out of electricity and tries to slow down
- your CPU has a bug
- your CPU has a hardware defect
- your CPU is running at too low voltage
These list items are not exclusive to each other. We really can't tell something more specific without more information.
a) a bug
b) a large job
Are you thinking of a particular daemon?
Slow, non-responsive systems are more normally caused by I/O contention than CPU usage, by the way. Install iotop
to see what's hogging your disk.
You can also nice
or renice
programs to free up the system a bit.
精彩评论