Jeff said:
What's the difference between sleep and hibernate?
Sleep keeps the contents of the OS session in RAM.
Standby power (all fans stopped, some PC LEDs still
lit up), powers the RAM. On a laptop, you can see
the power LED blink once a second, when in sleep state.
If you flip the switch on the back of the computer
(or remove the laptop battery pack), and cause +5VSB
standby power to go off. the session is lost.
Hibernate stores the contents of the OS session on disk.
A bit is set on the motherboard, telling the machine to
read the disk when the computer front power button (soft ON)
is pressed. But if you turn off all PC power, the OS
still seems to be able to figure out that it needs to
read the hiberfile when it next starts. This is a
form of "warm start", in that the OS files aren't individually
read, and the one long image in the hiberfile is just
copied back to the RAM verbatim. The program counter is
restored to where execution last left off (details unknown).
When the computer does this, the PCI card state information
is not valid, so the drivers have to be warm started, to
be ready to receive commands (init the registers on the card).
So there is still an element of preparation required before
a program can continue where it left off. I'm not sure
of the details, of how the OS prepares the PCI cards
for shutdown, such that the state will be consistent
after the warm start when the next boot starts.
*******
On later OSes, there is hybrid sleep. The session contents
are kept in RAM (which takes no work or time at all). But
the hiberfile is also written, as if to hibernate. If you
press the space bar on the keyboard, and nothing untoward
happened to the power on the computer, the session continues
from S3 using the contents of RAM. The restoration is fast
because everything needed is still stored in RAM.
If, on the other hand, you accidentally switch off the power,
all is not lost. On a power up and start, the hiberfile is
consulted, and RAM is filled up again. Hybrid sleep combines
the best features of the above two. Hybrid sleep means a
slower "shutdown" phase, but the "startup" phase uses
all best-case scenarios (no session loss, no dirty file
system).
The only thing lost by using hybrid sleep, is perhaps the
user might not be able to dual boot and switch OSes when
they want. But if you sleep an OS, the expectation is,
you wanted to continue running that OS on the next session.
To change OSes, you should be completely shutting down.
Only Windows 8 gets this wrong. If you select shutdown
on Windows 8, it uses hibernation for the kernel, which
means you cannot select a new boot drive at the BIOS
level. To stop that, you have to turn off hibernation
on Windows 8, to regain your lost freedoms. So Windows 8,
to give a faster "fake" boot time, makes running more
than one OS inconvenient. A little "powercfg -h off"
can fix that. Had to do that a couple days ago, for
a new Win8 setup.
Paul