Messages in this thread | | | Date | Mon, 10 Sep 2007 11:35:25 -0400 | From | Chris Snook <> | Subject | Re: Health monitor of a multi-threaded process |
| |
Yishai Hadas wrote: > Hi List, > > I'm looking for any mechanism in a multi-threaded process to monitor the > health of its running threads - or by a specific monitor thread or by > any other mechanism. > > It includes the following aspects: > > 1) Threads are running and not stuck on any lock.
If you're using posix locking, you'll never find yourself busy-waiting for very long. Use ps or top.
> 2) Threads are running and have not died accidentally.
Use ps or top.
> 3) Threads are not consuming "too much" CPU/Memory.
Use ps or top. You'll have to decide how much is "too much".
> 4) Threads are not in any infinite loop.
This requires solving the Halting Problem. If your management is demanding this feature, I suggest informing them that it is mathematically impossible.
Just use top or ps. Don't reinvent the wheel. We've got a really good wheel. If you don't like top or ps as is, read the ps man page to see all the fancy formatting it can do, and parse it with a simple script in your favorite scripting language.
-- Chris - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |