28 December 2009

Sleep modes, big green buttons and how my mother-in-law taught me something about computers

Until now, my mother-in-law and I have had some clearly understood boundaries. She is an excellent cook and fattens me up (further) with all manner of culinary delights whenever I visit. On the other hand, with computers she manages to hold the mouse the right way around most of the time, but I am the designated computer expert and therefore have to do the usual laptop fixing, virus removal, etc. of her machine whenever I go round.

But she has now crossed the line by buying me a Christmas present which actually taught me something I didn't already know about computers.

The present in question is an EcoButton(tm) which is basically a big green glowing button that you plug into a USB port and which puts your computer to sleep when you press it, thus saving the planet.

Obviously I initially dismissed this as a complete gimmick - after all, how is this any different from me putting my laptop to sleep by just shutting the lid? But before totally writing it off, I did go as far as reading their FAQs and then discovered that there was more to sleeping than I previously was aware of. After a bit of browsing around I am now slightly less ignorant so thought I should share.

Like most people, I thought that there were a few options for the power state of a PC:
  • Fully on
  • Sleep mode (minimal power to keep the memory going)
  • Hibernate (state dumped to disk but powered down)
  • Off
But it turns out that this is not the full story. Back in 1996, an open standard was produced to describe different power states, called the Advanced Configuration and Power Interface (ACPI). This has undergone a few revisions since then (version 4.0 is viewable here), but essentially defines different states for software and hardware power levels including a range of sleep states:
  • S1 - low wake latency sleep, processor clock off, bus clock stopped, <= 2secs wake
  • S2 - similar to S1, but processor and some buses are powered down. Slower than S1 to wake.
  • S3 - similar to S2, but all context is lost apart from system memory. Similar wake time to S2.
  • S4 - all devices (including memory) powered off with memory state stored to disc, i.e. this is what we know of as hibernate.
  • S5 - everything off, all context lost, i.e. this is what we know of as "shut down".
Also, with Windows XP it usually defaults to S1 rather than S3 even though the power consumption for S1 isn't anywhere near as good as S3 (Dennis Forbes did some tests on his machine and found S0 to be 129W, S1 112W and S3 5W).

So it turns out that what the EcoButton does when you press it is to run a command to force the machine into the S3 state rather than S1, and then show you a nice page when you reawaken that tells you how much money and CO2 you've saved.

Various people have found an undocumented Microsoft tool called dumppo.exe (download here) that shows you your current configuration and allows you to force the minimum sleep level to be S3 rather than S1:
C:\>dumppo admin
Admin policy overrides
Min sleep state......: S1
Max sleep state......: S4 - hibernate
Min video timeout....: 0
Max video timeout....: -1
Min spindown timeout.: 0
Max spindown timeout.: -1
To force the min sleep to be S3 do dumppo admin minsleep=s3 maxsleep=s4 and then reboot. Note that some USB devices may have problems with this, so you may need to revert if you experience any of these.

In Vista, Microsoft introduced a new "Hybrid" sleep mode where it saves a hibernate image in case power is lost, but then drops to S3 mode. It appears though that by default this is disabled in laptops - the thinking being that in a laptop you don't want it to sit there draining the battery but instead just go straight to hibernate if you're leaving for a long time. Checking my Windows 7 configuration this also seems to be the case there (control panel - power options - edit plan settings - change advanced power settings).

So what am I going to do? I spend most of my home life using a laptop, and tend to shut the lid when I'm not using it to send it to sleep. The big green glowing EcoButton is not going to make me do this any more often so I'll probably just plug that in to my less-used desktop. But I will switch on hybrid sleep mode, and as soon as my new power meter arrives I'll check out what the consumption really is.

And in case you're wondering, EcoButton claim that a typical user can save 135KG of CO2 in a year by using their button, so compare this against a single flight from the UK to NY at 1.3 metric tons of CO2 and you can see that although it's not earth-shattering it does make a difference.

Further reading: