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
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.
CIO SessionsVision Series on ZDNet
Brought to you by CBS MoneyWatch.com
- 10 Best Places to Retire
- Companies with the Best 401(k) Plans
- Most Important Document for Your Heirs? It's Not Your Will
- Video: Should You Expect to Retire Rich?
- Over 50? Here's How to Get (and Keep) a Great Job
Most Recent Technology Articles
- TELECOMMUNICATIONS : TELECOMS PACKAGE LEAVES COMMISSION, EP AND COUNCIL IN DISCORD.
- TELECOMMUNICATIONS : MEPS PRESSED TO FINALISE TELECOMS PACKAGE.
- AUTHORS' RIGHTS : PARIS PUTS GRADUATED RESPONSE' ON AUDIOVISUAL COUNCIL'S AGENDA.
- RAIFFEISEN INFORMATIK BUY OF PC-WARE AUTHORISED.
- MOBILE TELEPHONY : REDING OBTAINS "STRONG AGREEMENT" ON ROAMING.
Most Recent Technology Publications
Most Popular Technology Articles
- What is precision air conditioning and why is it necessary?
- Business process re-engineering in the small firm: A case study
- BizRate to monitor in-store customer satisfaction for Office Depot stores - Market Intelligence
- Base course modification through stabilization using cement and bitumen
- Speed control of separately excited DC motor
Most Popular Technology Publications
Content provided in partnership with http://findarticles.com/source//


