-2

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.

Thangaraj
  • 3,038
  • 7
  • 40
  • 43

2 Answers2

2

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.

Sebastian Mach
  • 38,570
  • 8
  • 95
  • 130
1

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.

spraff
  • 32,570
  • 22
  • 121
  • 229
  • This is not happening to me. but this is happening for others. I do agree that is because of bugs. Would be good what are the bugs it may have. Daemon have few threads as well. I suspect memory leak could be a culprit. I welcome all kind of suggestion. – Thangaraj Jul 11 '11 at 09:32
  • All guesses are equally useless in the absence of any evidence. If you're not familiar with the daemon internals, I can only suggest that you try to find a reproducible sequence of actions that triggers it, then file an official bug report. – spraff Jul 11 '11 at 09:40
  • My question is not what is the problem in my daemon. I just like to know what could be the possibilities for this. this is not to solve the problem. this question is intended to gather information to write good code in future. – Thangaraj Jul 11 '11 at 09:52
  • Gathering vague principles will do you no help at all. Direct experience of failure is the only way to get good :-) – spraff Jul 11 '11 at 10:19