How is the computer able to save things before it crashes?

Chrome and Microsoft Word periodically save your current state as you're working. If the application or computer crashes, when the applications relaunch, they look for a saved state on disk, and restore it for you. They don't need to predict the crash; they are constantly saving your state in case something goes wrong.


EDIT: This only works when an application crashes, not Windows.

Since Windows Vista there is a new API that allows Windows to call a special function in the application when it crashes so it can try to recover any data before it is shut down. It works like this:

  • App starts up
  • App calls Windows function: when I crash please execute RecoverData()
  • ...
  • App crashes
  • Windows executes RecoverData() in the App
  • RecoverData() tries to retrieve data about the currently opened document, in the mean time it keeps pinging Windows to tell it's still busy recovering.
  • When RecoverData() has finished/times out/stops pinging, Windows terminates the App and restarts it.

More info: http://msdn.microsoft.com/en-us/library/windows/desktop/aa373351(v=VS.85).aspx


Well, they just save the current state before they crash. Like an auto save every X seconds.

I think one really has to differentiate:

  • Hardware crash: Only able to recover with previous checkpoints
  • OS Crash: no way for app to save data, OS can drop something like a core dump
  • Application crash: OS features for application crash can save information