So, you're probably wondering why I'm posting this, because it's a bit off of my usual fare. The reason is I think it would be useful to make available a fairly simple algorithm for implementing a general purpose dead man's switch in whatever language you want, which is to say a DMS that could conceivably do just about anything if it activated.
But what's a dead man's switch? Ultimately, it's a mechanism that has to be manually engaged at all times if you want something to happen, and if that switch turns off for some reason, something else happens (like a failsafe). A good example of this is the bar on the handle of a power lawnmower you have to hold down so it'll move while the engine's running. If you let go of the bar the engine keeps running but the lawnmower doesn't keep rolling forward. Another example can be found in locomotives; the conductor has to hold down a switch or lever so the engine will pull the train, and if that lever is ever let go (say the engineer has a heart attack or is otherwise incapacitated) the throttle closes and the train will grind to a halt. More along the lines of what I'll be talking about are the watchdogs found in industrial controllers and realtime operating systems. While running normally a software process inside the device flips a bit somehow - say, writing a 0 into a certain device node. If the underlying hardware ever finds that the bit didn't get flipped within a certain period of time it reacts somehow to fix things (for example, it might reboot in an attempt to un-stick the gizmo).