How to force a thread to stop

H J van Rooyen mail at microcorp.co.za
Fri Aug 4 11:23:02 EDT 2006


"Gerhard Fiedler" <gelists at gmail.com> wrote:


| On 2006-08-04 02:33:07, H J van Rooyen wrote:
|
| > The next step above the 555 is a PIC... then you can steal power from the
| > RS-232 line - and its a small step from "PIC" to "PIG"...
|
| I see... you obviously know what to do, if you want to :)
|
| But I'm not sure such a device alone is of much help in a typical server. I
| think it's probably just as common that only one service hangs. To make it
| useful, the trigger process has to be carefully designed, so that it
| actually has a chance of failing when you need it to fail. This probably
| requires either code changes to the various services (so that they each
| trigger their own watchdog) or some supervisor program that only triggers
| the watchdog if it receives responses from all relevant services.
|
| Gerhard

 This is true - its trivial to just kill the whole machine like this, but its
kind of like using a sledgehammer to crack a nut - and as you so rightly point
out - if the process that tickles the watchdog to make it happy is not (very)
tightly coupled to the thing you want to monitor - then it may not work at all -
specially if interrupts are involved - in fact something like a state machine
that looks for alternate occurrences of (at least) two things is required - the
interrupt gives it a kick and sets a flag, the application sees the flag and
gives it the alternate kick and clears the flag, and so on, with the internal
tasks in the machine "passing the ball" in this (or some other) way - that way
you are (relatively) sure the thing is still running... but it needs careful
design or it will either kill the machine for no good reason, (when something
like disk accesses slow the external (user) processes down ) , or it will fail
to fire if it is something that is driven from a call back - the app may be
crazy, but the OS may still be doing call-backs and timing stuff faithfully -
you cant be too careful...

- Hendrik




More information about the Python-list mailing list