Robert Hensing's Blog

Software Security . . . and stuff.

Hybrid sleep in Vista and S0 - S5 explained

Hybrid sleep in Vista and S0 - S5 explained

  • Comments 1
  • Likes

Okay it's time for another shameless 'wow - Vista rocks' type blog post. :)  So I have a notebook and a desktop that I use with Vista daily.  I've never really sat down to investigate 'hybrid sleep' or what it is or how it works until this weekend (I admit - I'm lazy, I've *seen* the option - I've just never used it or thought much of it).

Briefly, hybrid sleep is just that - a hybrid between S3 (low power state, power still flowing to RAM) and S4 (hibernate, power off state).  For more on what S0, S1, S3, S4 and all those 'sleep state' numbering schemes mean - check out the Intel software blog here: http://softwareblogs.intel.com/2007/01/10/all-about-system-power-states-s0-s5/

Anyhoo, when 'hybrid sleep' is enabled in Vista when you make the machine sleep (by hitting the power button or using the power off thinger on the Start Menu) what happens is the system is placed into a low power sleep (for instant-on type resumes that laptop users are familair with) AND the system state is also stored in the hiberfile.sys file.  For geeks this is a hybrid of S3 and S4 states.  This way if you have a sleeping PC (S3) and it loses power (i.e. goes to S5) - when power is restored (S0) - it wakes up from the hiberfile.sys like a hibernate resume (S4). :)  Cool!  In Windows XP sleep and hibernate were two totally separate things - you either slept in 'standby' mode and if the power went out - you were screwed and lost your work - but now in Vista - by default for desktop PCs, hybrid sleep mode is enabled.  Now I had actually never witnessed this on my home desktop and certainly never on my notebook - and this is what i wanted to investigate things today. 

Turns out - on my home machine I must have run the disk cleanup thing and told it to remove the hiberfile.sys at some point (as described here: http://support.microsoft.com/kb/929658)  - when you do this Vista is smart enough to disable hybrid sleep (since you don't have a hiberfile to back it with).  To re-enable the hibernate option in Power Management I ran 'powercfg.exe -h on' from an elevated command prompt (as the article recommends).  After that I saw that hybrid sleep was enabled on my home PC and when I hit the 'sleep' button on my keyboard I saw that it did indeed appear to persist the contents of RAM to the disk after it was sleeping.  I haven't actually removed the power chord yet while it's sleeping to make sure it works - but I will. :)

Now - on notebooks - hybrid sleep is disabled . . . and this seems to make sense - Jimall described the thinking behind this here:
http://windowsvistablog.com/blogs/windowsvista/archive/2006/12/08/windows-vista-power-management.aspx
Basically - notebooks have a battery - if they are sleeping in S3 and the power is removed - they will just run off battery until the battery is critically low - at which point they hibernate anyways - so the net effect is the same.

Finally - if you want to hard-core geek out on this stuff - check this out:
http://download.microsoft.com/download/5/b/9/5b97017b-e28a-4bae-ba48-174cf47d23cd/CPA075_WH06.ppt

 

Comments
  • Machine sleeping is a bit of a mystery to many of us. It's one of those magical things that when it works

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment