Technology Industry
Industry: Email Alert RSS FeedProgrammatically Waking a Windows PC from Suspension
Enterprise Networks & Servers, Oct 2004 by Thompson, Blake
As computers take on more and more automated tasks, they seem to spend more and more time fully powered on. In many cases personal computers are left running 24 hours a day just to accommodate certain tasks that the computer may do during non-working hours.
For example, a disk utility may be set to defrag the hard disk during the middle of the night, or as we move into the era of the digital home, a computer may be left running so that the PVR software can record the user's favorite television show.
Most RecentTechnology Articles
- The Google Manifesto: Dr. Open and Mr. Closed
- RIM Is Getting Too Successful for Its Customers' Good
- Tech Law: Google Loses in France, GPL Suits Target Many, IBM Sued, More
- Microsoft Moves Fast, Already Has Custom XML Patch for Word
- Microsoft Might Get Advantage or Pain from Order To Not Sell Word
- More »
Mobile systems, however, have limited power resources. It would be unwise to leave a laptop powered on when not being used and running on batteries, just to perform a task in the middle of the night. Allowing a mobile system to go into suspension and then waking it as needed is a much smarter option. Certainly there are tasks that require the computer to be always on, for example acting as a Web server, but for other tasks there is often a better method.
Microsoft Windows and other operating systems have long had the ability to automatically put the computer into a suspension mode after a period of inactivity. This mode turns off certain parts of the computer and only uses a small amount of power to maintain the current memory state. While ideal for saving power, it does cause a problem for any scheduled tasks that may have to be performed by the computer. This document will cover both the technique of scheduling a Windows based computer to wake up from sleep mode to perform a task, as well as preventing the computer from transitioning to sleep mode during the task.
Let's pause a second and examine what it means for a computer to suspend. Modern computers have many different power states as defined by ACPI (Advanced Configuration and Power Interface), an industry standard interface for power management. These states are labeled SO through S5 and are summed up below.
S0 - Computer in running state
S1 - Computer in sleep state
S2 - Computer in sleep state
S3 - Computer in sleep state
S4 - Computer in hibernation
S5 - Computer off
Different levels of sleep save varying amounts of power, but deeper sleep states require longer for the computer to resume.
For this discussion we will focus on two general forms of suspension: sleeping or "stand-by" and hibernation. It is important to understand the key differences between the two.
Stand-by causes the system to shut down many non-vital components like the hard disk and the display. But it continues to keep power running to the DRAM in the system, thus maintaining any running applications and their data. This allows a very fast resume when the user pushes a key on the keyboard, moves the mouse, or presses the power button on the front of the case. But if the power goes out while in this state, the state of DRAM will be lost and any unsaved data with it.
Hibernation takes the contents of the DRAM and writes it directly to a special file on disk. It then proceeds to shut the entire system down, including the DRAM. Upon resume, the system reads the contents of hibernation file and places it back into memory. Resume is not quite as fast as stand-by, but hibernation uses less power and is less prone to failure if the power goes out. In hibernation, the system appears to the user to be completely powered off.
Typically, a computer is set up to go into the stand-by state after some specified amount of inactivity, and then to transition into hibernation after an additional amount of time. This is completely up to the user to configure.
It is important to note that the methods shown in this document allow the system to wake from either the stand-by state or the hibernation state, and the application doesn't really have to worry about which state it was in.
To illustrate automatically waking up a computer, it is helpful to establish a simple scenario using an imaginary Personal Video Recorder (PVR) application. Our PVR is set up to record our favorite shows, including our most favorite, infomercials. Since the very best infomercials air during the middle of the night we have to rely on our computer being able to record unassisted. Of course an easy way to make sure our computer is ready to go at 1:00 in the morning is to turn off all power management features and allow the computer to run all the time. But this would not be environmentally responsible and we could do without the extra heat generated by our computer during the summer months.
Since the little environmentalist in us has decided to allow our computer to sleep when we are not using it, let's see how this affects the PVR. We have set our computer to go to sleep after 30 minutes of inactivity. If no mouse movement or keyboard input is detected for that amount of time, and no other application informs the operating system (OS) to not go to sleep, the computer will transition to the sleep state. Of course during the day we actively use the computer, either typing some e-mail, browsing to a Web site or even watching a recorded show so it doesn't sleep during this active time. The PVR is able to record television in the background at the same time we are actively using the computer. But after we go to bed at 9:00, the computer also goes to sleep, after the required 30 minutes, at 9:30. At 1:00 as our favorite infomercial is airing, the system is still asleep and the PVR is unable to record the show.
CXO UnpluggedSmart Business interviews on BNET
Brought to you by CBS MoneyWatch.com
- Best- and Worst-Paid College Degrees
- 6 Things You Should Never Do on Twitter or Facebook
- How Much Sleep Do You Really Need?
- 6 Big Myths about Gas Mileage
- 5 Rules for Immediate Annuities
- Death in the Family: 12 Things to Do Now
- Dumbest Things You Do With Your Money
- 6 Online Networking Mistakes to Avoid
- 401(k) Mistakes to Avoid
- 5 Economic Scenarios to Keep You Up at Night
- The Real ‘Best Places to Retire’
- Best Credit Cards for You
- 12 Tough Questions to Ask Your Parents
- The Real ‘Best Colleges’
- Home Buyer Tax Credit: How to Cash In
- Why You Shouldn't Bash Cash
- 8 Phony 'Bargains' and Better Alternatives
- Danger: 3 Debit Card Scams to Avoid
- 6 Myths About Gas Mileage
- 29 Fees We Hate Most
- Quick and Easy Ways to Boost Returns
- Best Stocks to Buy Now
- Lower Your Taxes: 10 Moves to Make Now
- New Jobs: 8 Lessons from Real-Life Career Switchers
- The New Job Market: Who Wins and Who Loses?
- Health Care Reform's Public Option: Everything You Need to Know
- Volunteer Work When Unemployed: Should You Work for Free?
- Whose Recovery Is This?
- Long-Term-Care Insurance: 4 Biggest Risks to Avoid
Content provided in partnership with
Most Recent Technology Articles
Most Recent Technology Publications
Most Popular Technology Articles
- BizRate to monitor in-store customer satisfaction for Office Depot stores - Market Intelligence
- Speed control of separately excited DC motor
- Effects of creative, educational drama activities on developing oral skills in primary school children
- Political stability and economic growth in Asia
- Failed businesses in Japan: a study of how different companies have failed, and tips on how to succeed, in the Japanese market




