As other posters have mentioned, it is next to impossible to detect a hung process from outside without really having a clear determination of what can be measured to determine hung-ness. Simply examining the PC won't necessarily help, since it will change inside a system call even though that call never returns (for whatever reason)(*). You could rely on a timer (if no data is received/ sent for X minutes, restart the process no matter what) and would get varying degrees of success, but again you would need some way to measure this data from outside the app - perhaps it writes to a log file or whatever.
From a quick hack point of view you will have some luck with the above approach, but for true robustness you'll be better off modifying the app itself, if possible.
(*) - Actually you *might* get some results from running the app under an strace-like utility, and watching to see if any system call loops for "too long" - but you're left with again defining what "too long" means, and of course parsing strace output.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.