why does sleep require video driver but hibernate does not

bwanaaa

Senior member
Dec 26, 2002
739
1
81
A native install of windows 7 pro results in my graphics card, gtx 670, using the window drivers. This allows 2D graphics only. In the start menu is the option to hibernate or shut down but nothing for sleep or standby. Only after installing the graphics card driver does sleep/standby become an option. Why is this?
 

denis280

Diamond Member
Jan 16, 2011
3,434
9
81
By MS.
What's the difference between sleep, hibernate, and hybrid sleep?

Sleep is a power-saving state that allows a computer to quickly resume full-power operation (typically within several seconds) when you want to start working again. Putting your computer into the sleep state is like pausing a DVD player—the computer immediately stops what it’s doing and is ready to start again when you want to resume working.
Hibernation is a power-saving state designed primarily for laptops. While sleep puts your work and settings in memory and draws a small amount of power, hibernation puts your open documents and programs on your hard disk, and then turns off your computer. Of all the power-saving states in Windows, hibernation uses the least amount of power. On a laptop, use hibernation when you know that you won't use your laptop for an extended period and won't have an opportunity to charge the battery during that time.
 
Last edited:

bwanaaa

Senior member
Dec 26, 2002
739
1
81
tnx for the attempted reply but my question remains unanswered. Why are VIDEO DRIVERS required for sleep since they are not needed for hibernate?
 

ViRGE

Elite Member, Moderator Emeritus
Oct 9, 1999
31,516
167
106
tnx for the attempted reply but my question remains unanswered. Why are VIDEO DRIVERS required for sleep since they are not needed for hibernate?
Because resuming hibernation is handled by the BIOS, not the OS. The OS needs drivers to tell the video card what to do, but the BIOS is simply using low level interfaces.
 

Matt1970

Lifer
Mar 19, 2007
12,320
3
0
I suppose any driver could do it but (I may just be talking out my butt here) I think it just makes sense to use the video driver. The video driver is already handling dimming and turning off the display after a certain amount of time as well as the screen saver.
 

JackMDS

Elite Member
Super Moderator
Oct 25, 1999
29,545
422
126
Standard Hibernation actually saves on the hard drive a snapshot of the RAM at the time before switching OFF.

Yes, Hibernation totally switches off the computer.

Waking from Hibernation is done by Hardware it wakes the computer and install back active RAM as it was before (including the Drivers).

Typical power use to keep the hardware ready to wake up during Hibernation is 2-3 Watts.

Sleeps Just reduce the activity of the component it does Not switch off the computer.

How do I switch On Hibernation in Win 7?

From the Command line you issue the command - http://www.sevenforums.com/tutorials/819-hibernate-enable-disable.html



:cool:
 

corkyg

Elite Member | Peripherals
Super Moderator
Mar 4, 2000
27,370
239
106
Hibernation is also used by some Uninterruptable Power Supplies as a method of shutting down gracefully.
 

bwanaaa

Senior member
Dec 26, 2002
739
1
81
Because resuming hibernation is handled by the BIOS, not the OS. The OS needs drivers to tell the video card what to do, but the BIOS is simply using low level interfaces.

Really?
Either way, the drivers for a variety of devices have to be loaded.If I come back from hibernation, the system is basically rebooting itself and then filling the ram with whatever is in hiberfil.sys.
With standby, the ram is already alive. So the OS has to actually wake up all the hardware which it turned off. I guess the OS designers never had the idea of reloading the drivers and this has been the source of countless problems-including usb devices not working, hard drives not working, etc when resuming from standby. And the same goes fr video drivers i suppose. But if sleep is a function of the OS and not the bios, then why do I have to go into the bios to enable s1, s3 or s4?

Does this distinction imply that the OS just signs off with a different kind of 'goodbye' to the bios and it handles everything? Sleep and hibernation have existed (and not worked well) since forever. And just like overclocking, it was something handled by the bios. This was the APM model. Then came ACPI with the OS getting into the act.
http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface

But I cannot see in that wiki where there is a distinction between sleep and hibernate. In fact, there is a tremendous vagueness about the responsibility that seems to depend on the motherboard manufacturer. When it comes to video cards, there is
Active State Power Management - hardware power management protocol for PCI Express.
http://en.wikipedia.org/wiki/Active_State_Power_Management
This article specifically states 'this is usually managed by the operating system's power management software or through the BIOS'.

In trying to understand the specific steps of what happens when resuming from standby and how that differs from a regular cold boot or a resume from hibernation, even the internet is confused and cannot come up with a clear answer. I know however, that there is a human who knows this process well. Maybe even written about it somewhere. Probably deep and byzantine complexity involving PHY layers and HAL so that no one has linked to it. So no search algorithms rank them well.

WOW, that really went off topic.
 

ViRGE

Elite Member, Moderator Emeritus
Oct 9, 1999
31,516
167
106
But if sleep is a function of the OS and not the bios, then why do I have to go into the bios to enable s1, s3 or s4?
My description was meant to be very brief and to the point. As I'm sure you're aware, in practice it's a lot more complex.

Both sleep and hibernate require the cooperation of the OS and the BIOS. However when it comes down to it the OS is in charge of sleeping, while the BIOS is in charge of hibernation.

In the case of sleep the idea is that the OS continues to manage the system, and that its primary role is to direct other devices when and how to go in and out if their own sleep states. This is very fast (because the devices don't need reinitialized as the BIOS level), but it requires that the OS have an in-depth knowledge of each device (though its driver) to know how to bring it in and our of sleep.

The BIOS factors into all of this as it serves two important roles. First and foremost, it's the watchdog for the OS. When the OS goes to sleep its the BIOS's job to watch for wakeup timers and wakeup events, and in turn pass those on to the OS. The second role of course is that the BIOS needs to know to shut down the CPU while keeping the RAM powered up, and what the right order of operations is to wake the OS back up.

Hibernation on the other hand is simpler in many ways. The RAM gets written out to the hibernation file, and then most system components are cleanly shut down. The BIOS is in turn left with the task of monitoring for wakeup events, and knows that its in hibernation mode and can skip POST events when it wakes up. Once the system does wake up, it quickly reinitializes every device and begins loading the contents of RAM from disk.

Hibernation in practice is far closer to a special case of booting a computer, where you get to skip a bunch of stuff. But the important part is that everything is fully shut down when going into hibernation, which saves the most power but is also why most devices require full reinitialization.

Really, the most important thing to understand about sleep and hibernation is the difference in their design philosophies.

Sleep: How much stuff can we power down without requiring reinitialization, and how do we do it? The emphasis is on speed over power savings, leading to devices being left in a low power state (as opposed to powered down) so that they can be resumed quickly. The OS is responsible for goggy devices.

Hibernation: What shortcuts can we take to bring a system back to a usable state after a complete power down and reinitialization? The emphasis is on power savings ahead of speed, in the sense that we're trying to resume the system as quickly as possible without surrendering any of the power savings of a complete power down. The BIOS is responsible for groggy devices.

Think of it like herding school children. Hibernation is the equivalent of parents (BIOS) waking their kids up and preparing them for school (the OS), while Sleep is the equivalent of parents pulling their kids out of bed and dropping them off at school as-is. Sleep is faster for the parents, but it's hell on the school.:p
 
Last edited:

bwanaaa

Senior member
Dec 26, 2002
739
1
81
tnx for that thoughtful reply - it helped. BUT, specifically i was hoping for the particular code that the OS uses to go into standby with line by line explanation of all the system calls.
and in particular was interested in how the OS accesses the bios to accomplish this process.

Also when going into standby there is the peculiar paradox of shutting off devices one by one without causing a system error or corruption of the ram. after all, the ram is required for the cpu to function. as the os goes into standby, the ram is dynamically changing to reflect that. Once in standby mode, the ram as well as the cpu registers contain the 'go to sleep' code as well as all the flags that tell the devices on the motherboard to go to sleep. to change the contents of the ram and the cpu registers though you have to wake up the pc. But if you start to wake up the pc it should see this 'go to sleep' state and go back to sleep.

eek.gif
 

imagoon

Diamond Member
Feb 19, 2003
5,199
0
0
Start reading then:

http://www.acpi.info/

Make sure to look at all the extras for EFI and SMBIOS also.

Your understanding of sleep isn't correct. In sleep the CPU and RAM are never completely off. There are specific code paths in the CPU that handle the return from say S4 so there is never the "go to sleep" code left sitting in the code stream because that stream has already been executed and removed from the code stream and the resume code will be called on wake up.

The reason your video card needs a driver for sleep is that in order to support sleep, all devices in the computer need to support the ACPI interface and that is typically provided in the driver for the device. The basic Windows VESA drivers do not have the ACPI code needed so the machine is not ACPI compliant and thus not able to sleep.

Hibernation is a full reboot. On resume from hibernation the BIOS will handle all the hardware setup and then like a normal boot, hand control to the OS which will reload ram, CPU device buffers etc and resume. Some BIOS support the concept of fast boot to go with hibernation which tells the BIOS to skip varies tests to speed up the resume but that is not required.