sysint, emergency application

Werner Almesberger werner at
Wed Apr 14 01:50:33 CEST 2010

mobi phil wrote:
> it would  "freeze" anything else, [...]
> application would be very small, would just show a number, or would do fast
> lookup in a database with phonenumber etc.

Chances are that it will deadlock if everything else is really
frozen :-)

Naw, I'm not sure what specific problem you want to solve, but this
concept sounds very dubious to me. If you're concerned that some
unreliable daemon is handling all the kernel events, then you could
extend it such that the events you're particularly interested in
get passed through your watchdog first.

There are also some events the daemon won't/can't "steal" from

You can make your watchdog very resistant to any upset. Root can
still kill it, but little else would scratch it - no runaway
process, no fork bomb, no out of memory condition.

Once upon a long ago, I wrote a user-space watchdog to handle the
forced shutdown (power-off) when pressing POWER for more than 8
seconds. This is quite similar to what you described. The code is

The function invulnerabilize in neodog.c is probably what you're
looking for. It ignores most signals, locks all pages into physical
memory (so OOM can't kill you), and sets the highest scheduling
priority (so nothing can preempt or starve you).

While debugging your main loop, it's a good idea no to call
invulnerabilize, or every busy loop will hang your system.

- Werner

More information about the openmoko-kernel mailing list