do stuff after shutdown

Laurent Bercot ska-dietlibc at skarnet.org
Tue Feb 28 07:23:20 UTC 2012


>>  If process 1 terminates, UNIX semantics are done for. From the moment
>> process 1 dies and the system enters kernel space to handle this death,
>> the system never goes into user space again.
> Think about SMP systems...

 * Any clean shutdown sequence would still have to kill all processes,
just like it is done today; but instead of calling reboot() or poweroff(),
process 1 would just _exit() at the end. If process 1 is the only remaining
process on the machine, there is no race condition, SMP or not.

 * If process 1 terminates while there are still other processes alive
on the machine, it may or may not be a clean shutdown, just like a reboot
with other processes alive may or may not be clean today, depending on
the disk mounts state.

 Today's SMP systems know how to handle a shutdown. My suggestion does
not change that. It does not remove the need for a proper userland
shutdown sequence; it does not assume that process 1's exit does anything
magical. (auto-unmount everything! auto-kill everything! wheee!)

 I am *only* suggesting that process 1 exiting should be taken as a hard
reboot or poweroff instruction, instead of a panic instruction.
 Is there something I have missed that would still be a potential problem
with SMP systems ?

-- 
 Laurent


More information about the busybox mailing list