6

I'd like to be able to have my computer resume to it's last state (open programs etc) in the event of a forced or unintended power-off without having to actually hibernate or hybrid-sleep my machine.

Is this possible? Windows boots off of the hibernation data that is created when one hibernates or hybrid-sleeps but is it possible to manually create/update this hibernation data within windows?

Is there a third-party program that can accomplish something similar? (excluding virtual machines) I don't need an exact state save, but at the very least a method for remembering what was open and opening them again.

As it stands now, I sleep the system (hybrid sleep) after 1 hour of inactivity so in the event of a power loss, it can boot off of the hybrid-sleep state data. This is fine but it prevents me from being able to have anything running 24/7 without having to deal with occasional power losses. (which seem to happen a lot more frequently than they should)

5
  • 3
    Without using a virtual machine (which can take a snapshot of an entire machine - software and hardware simultaneously) or a layer to abstract any hardware changes (e.g. a hypervisor), this is just impossible. This subverts the normal workings of any modern operating system... As a crude but notable example, consider what would happen if you modified certain files on your hard drive, then resumed a previous execution state (itself assuming the filesystem was unchanged, as most operating system drivers take sole access of it upon launch). Jun 13, 2013 at 18:58
  • TL,DR: Without a hypervisor/virtual machine, no. This is why we use either technology in the first place. Jun 13, 2013 at 18:59
  • @Breakthrough - It is not the sole reason. There are obvious energy consumption/multitasking gains but I see your point. Why however is hibernation data kept on a disk after having woken up if it can serve no further purpose? New hibernation data must be created each time.
    – Enigma
    Jun 13, 2013 at 19:12
  • 3
    The data isn't deleted so the space it reserved won't be taken by other apps. Deleting (really resetting the bit) of the file would be redundant since it will be rewritten on the next hibernation anyway.
    – Martheen
    Jun 15, 2013 at 8:54
  • 1
    A hardware supported solution would be installing a UPS that can signal the PC on power loss, then initiate hibernate. And a RTC alarm or network wake up that will power up the system when power returned
    – Martheen
    Jun 15, 2013 at 8:57

2 Answers 2

8

There are at least two reasons why you can't do it.

First one. Hibernation works thanks to ACPI power states. It's not that simple as "dump RAM to hard drive and shutdown". RAM isn't everything, there are also devices that need to be reverted into their previous state. That's where ACPI joins the party - it lets you suspend devices when entering S5 state and resume them when returning to S0. But S5 implies shutdown, so you can't hibernate computer without shutting it down.

Second one. Let's assume we have some hardware that would allow to hibernate a running computer while keeping it on. This creates a problem similar to those that you could face when dealing with parallel computing.

Computers work sequentially. They execute series of simple (really simple, like "increase that number by 4") instructions, one by one. Modern PCs have multicore CPUs and could theoretically process multiple instructions at once, but it's not always possible. For example let's say we have three instructions.

  1. Read X from user.
  2. Multiply X by 2.
  3. Increment X by 7.

Step 2 can't be processed until step 1 is finished, because X is unknown at that time. Similiarly, step 3 can't be processed until step 2 is finished, because value of X is very likely to change in step 2. These steps must be processed one by one.

Now let's imagine we have a computer that processes bank transfers. You have some amount of money on your bank account and you want to transfer $100 to your friend's account. The algorithm looks like this and has to be processed step by step for some reason:

  1. Decrement the amount associated with your account by $100.
  2. Increment the amount on your friend's account by $100.
  3. Transfer has been processed, so remove it from the transfer queue.

Computer starts to process this transfer and suddenly, between steps 1 and 2 it turns off due to a power outage.

Now, if the computer wasn't "hibernated but alive", it will start to boot and realize that something went wrong - it will know that it should verify all recent operations. Everything is fine.

But if it was "hibernated but alive" before it started to process step 1, there's a problem - the computer doesn't know something went wrong, because it remembers everything was fine when it was being hibernated. But the data on hard drive has been updated and $100 is already withdrawn from your account, but not transferred to your friend's account yet. But computer doesn't know about that, because it happend after hibernating it.

The computer will take another $100 from your account and transfer it to your friend. The first $100 is gone.

There are hundreds of thousands of problems like that that could arise prom "hibernating" a running system.

4
  • Well explained but disappointing. I'm more interested in getting a rough approximate of the last running state when I leave from work to go home so that in the morning the next day, I can continue where I left off. Even if it amounts to storing individual states for all the running/open programs so that when the OS boots, it can load them all significantly faster and automatically.
    – Enigma
    Jun 13, 2013 at 18:24
  • Isn't that exactly how hibernation works?
    – gronostaj
    Jun 13, 2013 at 20:09
  • at the very least, but it also saves the entire OS state as well and all attachment points.
    – Enigma
    Jun 13, 2013 at 20:43
  • 1
    There's an API in Windows that enable apps to return to where they're left, but upon restart dotnet.dzone.com/news/restart-windows-and-restart According to this msdn.microsoft.com/en-us/library/aa373347%28v=vs.85%29.aspx the app must be specifically coded to support the code. The first link mentioned it work with Microsoft's own app.
    – Martheen
    Jun 15, 2013 at 8:51
3

You can accomplish something similar if you were to work within a virtual machine. With a virtual machine, you can take snapshots of your computer at any point in time and revert back to them. This can be done with VMWare, Hyper-V, and VirtualBox.

You must log in to answer this question.

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