5

There is a new option in the power management system preference to "restart automatically if the computer freezes".

How does this work exactly?

How can the computer check that it is frozen if it is, well, frozen? Is there anything else that it can still do at that point? For example, will there be a log written about this? Can there still be situations when it is so frozen that it cannot restart itself? Is there danger of accidental restarts when it is not really or only temporarily frozen? This does not happen when a single application decides to beach-ball, right?

2
  • 1
    I don't know how it works "exactly," but I have not seen this happen when a single application beach-balls or when the computer is "temporarily" frozen. In fact, in my experience, the only time I've seen this happen is when the computer has suffered a kernel panic, not simply a UI "freeze" as you would normally think of it. OS X has been able to log such a panic for quite a long time, so I presume that there is some high level process (launchd?) which waits for a signal call indicating a panic, and then starts a reboot timer similar to 'shutdown -r X' where X is some number of seconds.
    – TJ Luoma
    Dec 13 '11 at 6:58
  • I have seen "kernel panic" screens before (and then there would also be a log file). So is this when it can reboot automatically now? And conversely, will it not work when there is a freeze without the "kernal panic" alert box?
    – Thilo
    Dec 13 '11 at 7:05
8

The Mac models that support this have a secondary processor, independent of the CPU (it's the LOM on Intel Xserves, SMC on regular Macs). Basically, the secondary processor can have a countdown timer set up, and reset the CPU (forcing a reboot) if the counter hits 0. Meanwhile, a process running within OS X (originally it was a program called watchdog, but I think launchd handles it now) resets the counter periodically.

If the OS ever gets hosed enough that launchd/watchdog/whatever fails to reset the counter within the time limit, the LOM/SMC/etc takes over and forces a reboot.

BTW, regarding @TJ Luoma's comment on kernel panics: when a panic occurs, the OS is basically dead. There's no way for launchd to be notified of this, because it's dead along with everything else. What happens is that some information about the panic gets stuffed into NVRAM (the surviving shreds of the OS can access that without needing drivers, etc, which all went away in the panic). After reboot, the NVRAM is checked and (if appropriate) its contents are reported in the panic log.

1
  • 2
    Thanks, that's a much clearer explanation than I have ever heard before.
    – TJ Luoma
    Dec 13 '11 at 22:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .