Ask Leo! #700 – What’s the Difference Between Hibernate and Sleep?

This Week's Newsletter

To sleep or to hibernate? Aye, that's the question.

Also: What to do if you think your Facebook account has been hacked, and speaking of sleeping, will a scheduled backup wake it up?

Also, last week's Ask Leo! on Business article, You Are Not Your Customer garnered a mention in a great newsletter I subscribe to: For The Interested -- check it out!

What's the Difference Between Hibernate and Sleep?

(skip)

Sleep (also called “standby”) and hibernate modes are alternatives to shutting down your computer completely. The idea is that when they're used, your computer will either shut down faster, start up faster, or both.

The primary difference between the two is what happens to the contents of your computer's RAM, but there are more subtle differences as well.

Shut down and restart

First, let's look at what happens to your computer when you don't use sleep or hibernate.

When you shut down or power down your computer, a number of things happen.

  • Any running programs are told that the system is shutting down. They may or may not warn you about any open files you have, after which the program exits and is removed from RAM.
  • Any software services that are part of Windows itself are also told of the impending shutdown, so they can perform any necessarily cleanup, writing anything that needs to be preserved to disk for the next time the machine is turned on.
  • The software drivers associated with the hardware in or attached to your machine are also told of the impending shutdown, so they can do the same thing, in addition to turning off the hardware they control (or perhaps resetting it to a safe state, if needed, before power is removed).
  • Finally, any last-minute information is written to disk, and the system instructs the hardware to turn off the power, at which point everything in RAM is erased.

When the power is turned back on to restart the computer, a similar sequence happens in reverse from the shutdown process.

  • The boot process causes Windows itself to be read from hard disk and placed into RAM, where it can control your machine.
  • The drivers associated with your hardware are loaded from disk into RAM and initialized. They typically initialize the hardware that they control.
  • The services associated with the various Windows features and functions are loaded from disk into RAM and run, each initializing itself to whatever state is required to perform its task.
  • Finally, the applications you have configured to run automatically are loaded from disk into RAM and run. Once again, each initializes itself into some known state in preparation for whatever task it's intended to perform.

Even though what I've presented is an oversimplification, you can already see that shutting down and starting up are complex processes that take time.

Sleep and hibernate are two different approaches to optimizing the shutdown and startup process.1

Hibernate: write RAM to disk

One of the common threads in the startup and shutdown processes outlined above is that each process — be it an application, a service, or a hardware driver — needs to initialize itself on start up or clean itself up on shutdown. Frequently, this is nothing more than collecting and maintaining information in the computer's memory or RAM.

The hibernate process is relatively simple, at least in concept. Rather than having all the software shut down and then later re-initialize itself, hibernate attempts to preserve that state in a way that takes less effort.

  • Applications, services, and drivers are notified that hibernation has been requested. They still have the option to do something, if they like (drivers, in particular, may still need to set their associated hardware into known states), but it's also possible that they need do nothing.
  • The contents of RAM are written to disk. All the loaded and running programs are included in the exact state they happen to be in, including any data they've initialized and maintained.
  • The system instructs the hardware to turn off the power, at which point everything in RAM is erased.

When you resume from a hibernation state, the process is reversed.

  • The system's boot process reads the image that was saved into RAM when the machine was placed in hibernation.
  • The applications, services, and drivers — all already loaded into RAM — are notified that the system has resumed, in case they need to perform any initialization. (Again, hardware drivers are typically the most impacted.)

That's it. Your system is back up and running. It's usually quicker than a full shutdown and restart because all the software doesn't have to be individually loaded and initialized from scratch.

Sleep: keep RAM in RAM (at a cost)

Sleep takes things one step further by not bothering to write RAM to disk. The process is even simpler.

  • Applications, services, and drivers are notified that a sleep is happening. Most do nothing about it at all, though once again, drivers may elect to put their hardware into a low-power state.
  • The system instructs the hardware to turn off the power — mostly. A small amount of power is left on to keep RAM from losing its contents.

As you can see, sleep causes very little activity, and can therefore happen very quickly.

Resuming from sleep is similarly straightforward: the power is turned on and the software still in RAM resumes operating.

The “cost” of sleep, however, is that unlike hibernation — which truly and completely powers down your device — sleep uses a small amount of power to keep RAM from losing its contents. Particularly if your computer is battery-powered, this means that eventually a sleeping computer will run out of power and need to do something about it. Typically, it wakes up long enough to put itself into hibernation.

Windows 10 fast startup: hibernate, sort of

I have to call out Windows 10's fast startup option as being somewhat of a third alternative to a true shutdown, hibernate, or sleep.2

Fast startup, as I understand it, lies somewhere between a true shutdown and hibernation. Rather than doing the full and individual shutdown and initialization sequence, fast startup puts some aspects of the system into hibernation. Exactly which, and what the specific differences are, I couldn't tell you.

Which is better?

Hibernate and sleep are neither better nor worse than one another. They're different and are intended for different purposes.

Sleep is great if you just need to close your laptop for a while but expect to be back at it before any significant battery drain has occurred. Hibernate is great as an alternative to shutting down most of the time, though we'll see in a moment that sometimes only the real thing will do.

Honestly, the “better” one is whichever works well for you, on your machine and in your situation.

Problems with sleep and hibernate

Both sleep and hibernate have a long history of not quite working. Particularly in years past, it wasn't uncommon for a machine not to resume properly or for something to be “not quite right”.

A true shutdown and restart always resolved the issue.

The problem mostly stems from all the device drivers that deal with the hardware on your machine. They each need to be aware of sleep and/or hibernate, and either state could impact the hardware's performance. The answer is different for different hardware, and quite possibly different for the state the hardware happens to be in at the moment you put a machine into sleep or hibernate. The fact that device drivers come from a variety of sources doesn't help.3

Many drivers got it wrong. While most now get it right, they can still be fragile when it comes to both sleep and hibernate. If something's “not quite right” after resuming or waking up, a restart might be in order.

You still want to restart periodically

Any issues caused by sleep and hibernate aside, you still want to shutdown and restart, or reboot your machine from time to time.

As much as Microsoft might desire otherwise, instability accumulates over time. Especially for a computer that's being used for many different things, with many different programs coming and going, or even just a poorly written program that's left running all the time, sometimes you just need to reboot to start afresh.

Even though you might get to a point where hibernate and sleep are viable, it's an opportune time to consider avoiding both options anyway and performing a “real” shutdown instead.

That's what I do. Rarely do I sleep or hibernate my computers, even my laptops. Years of misbehavior have trained me to avoid them, and even though they're more stable than ever, I just feel better with a complete shutdown and clean restart.

Related Links & Comments: What's the Difference Between Hibernate and Sleep?
https://askleo.com/41519

Get Backing Up In Windows 10 Today!

Facebook Hacked? What You Need to Do NOW

Much like email, it's not uncommon for someone, somewhere, to gain access to a Facebook account and use it to post spam or worse. Sometimes, the account password is changed. Sometimes not. Sometimes, traces are left. Sometimes not.

Sometimes, the entire account is destroyed.

If you think it's happened to you, here's what you need to do next.

Continue Reading: Facebook Hacked? What You Need to Do NOW
https://askleo.com/7708

Will a Scheduled Backup Wake My Machine Up If It's Sleeping?

If my computer is scheduled to back up my files on, for instance, Saturday night, and it's sleeping, does the backup still occur? I received a warning that my backup was not successful: “The request could not be performed because of an I/O device error.” I'm backing up to a Western Digital external hard drive.

The short answer is: probably not.

But that answer doesn't relate to the error message you're seeing.

Continue Reading: Will a Scheduled Backup Wake My Machine Up If It's Sleeping?
https://askleo.com/5726

The Ask Leo! Tip of the Day

A feature exclusively available to Ask Leo! Patrons Bronze level & above.

More Ask Leo!

Tech Enthusiast Hour: I'm one of the regular hosts of the weekly Tech Enthusiast Hour podcast! Join us as we discuss the latest news & tech goings on. More information at tehpodcast.com!

Become a Patron
Ask Leo! Books
Facebook - YouTube - More..

Leo's Other Projects....

HeroicStories Since 1999, HeroicStories brings diverse, international voices to the world ' reminding us that people are good, that individuals and individual action matter. Stories - new and old - are published twice a week.

Not All News Is Bad - Each day I look for one story in the current news of the day with a positive bent. Just one. And I share it.

leo.notenboom.org - My personal blog. Part writing exercise, part ranting platform, it's where I write about anything and everything and nothing at all.

Help Ask Leo! Just forward this message, in its entirety (but without your unsubscribe link below) to your friends. Or, just point them at https://newsletter.askleo.com for their own FREE subscription!

Newsletter contents Copyright © 2018,
Leo A. Notenboom & Puget Sound Software, LLC.
Ask Leo! is a registered trademark ® of Puget Sound Software, LLC

Posted: April 17, 2018 in: 2018
Shortlink: https://newsletter.askleo.com/7865
« Previous post:
Next post: »

New Here?

Let me suggest my collection of best and most important articles to get you started.

Of course I strongly recommend you search the site -- there's a ton of information just waiting for you.

Finally, if you just can't find what you're looking for, ask me!

Confident Computing

Confident Computing is the weekly newsletter from Ask Leo!. Each week I give you tools, tips, tricks, answers, and solutions to help you navigate today’s complex world of technology and do so in a way that protects your privacy, your time, and your money, and even help you better connect with the people around you.

The Ask Leo! Guide to Staying Safe on the Internet – FREE Edition

Subscribe for FREE today and claim your copy of The Ask Leo! Guide to Staying Safe on the Internet – FREE Edition. Culled from the articles published on Ask Leo! this FREE downloadable PDF will help you identify the most important steps you can take to keep your computer, and yourself, safe as you navigate today’s digital landscape.



My Privacy Pledge

Leo Who?

I'm Leo Notenboom and I've been playing with computers since I took a required programming class in 1976. I spent over 18 years as a software engineer at Microsoft, and after "retiring" in 2001 I started Ask Leo! in 2003 as a place to help you find answers and become more confident using this amazing technology at our fingertips. More about Leo.