Saturday, October 26, 2013

How Windows 8 Hybrid Shutdown / Fast Boot feature works

Sleep, hibernate, fast boot, and hybrid shutdown are not all the same thing in Windows 8. Greg Shultz explains how it all works. 

dog_and_cat.jpg
A friend of mine recently got a new Windows 8 system and after using it for a couple of weeks sent me a list of questions that she had about some of the features in the new operating system. She also had quite a lengthy list of questions about features that she had been used to using in previous versions of Windows, which were either no longer available or changed in some way in the new version. While I was able to answer all of the questions to her satisfaction, one set of related questions stood out for me.
She asked me why the default Power menu had both Sleep and a Shut down commands, as shown in Figure A. "Aren't these operations the same thing in Windows 8 with its new Hybrid Shut/Fast Boot feature?", she asked. And, isn't Fast Boot essentially Hibernate?

Figure A


Fig A 10-25.png

By default the Power menu has Sleep and Shut down commands.
As I pondered the answers to these questions, I realized how difficult it could be to describe. I also realized how easy it is to be confused by the whole thing and thus I decided to write this article.

Overview

The goal of Fast Boot is pretty obvious from its name - Windows 8 boots up faster than previous versions of the operating system ever did. To accomplish this feat, Windows 8 doesn't totally shut down when you click the Shut down command. Instead it only partially shuts down and partially hibernates. This is the Hybrid Shutdown part of the equation. Then, when you turn on your computer, Windows 8 starts very quickly because it only has to partially boot up and partially wake up. This is the Fast Boot part of the equation. Fast Boot also gets a boost from the efficiency of today's hardware; namely UEFI (Unified Extensible Firmware Interface) and multi-core processors.
To understand how all of this works, we really have to build a foundation of knowledge. Of course, when you really dig into all the nuts and bolts of this system, it gets very technical. However, in this article, I'll just give you the basics in fairly general terms.

A cold boot operation

Let's begin with a basic understanding of how a computer boots up from a complete shut down. There are essentially three stages that a computer goes through as it boots up. When you turn on a computer, the first thing that happens is the system's firmware boots up and gets the computer hardware ready for the operating system. Next, the operating system boots up and gets everything ready for the user. Then, the user logs in and the operating system sets up the user's environment so that the user can launch applications and get to work. If we simplify these stages, we have what I'll call the hardware session, followed by the kernel session, and then the user session.

A shut down operation

As you can imagine, a shut down operation essentially works in reverse. But for the sake of being complete, let's cover it anyway. When you shut down Windows, the user session shuts down first, then the kernel session shuts down, and finally the hardware session shuts down.

A Hibernate operation

Since a big part of Fast Boot builds upon the Hibernate feature, let's take a brief look at how the Hibernate feature works. If you used the Hibernate feature in previous versions of Windows, as shown in Figure B, then you know that a system coming out of hibernation boots up faster than a system that is performing a cold boot, i.e. a system that starting up from scratch after being completely shut down.

Figure B


Fig B 10-25.png

The Hibernate command on the Shut down menus of Windows XP and Windows 7.
The reason for this is that when you hibernate your computer, the operating system doesn't really shut down. Instead, it saves the current system state and the contents of memory to a file called hiberfil.sys and then it shuts down the computer – the hardware. Later, when you turn on, or resume, the computer, rather than performing a cold boot of the entire system, the operating system reads the contents of the hiberfil.sys and then restores the system state and memory to the exact same condition they were in when the system went into hibernation. This restoration, or resume, operation can occur much faster than a computer can boot up from a complete shut down.
Of course, resuming from hibernation comes with a "your mileage may vary" clause. The reason being that the speed with which the system resumes depends on how big the hiberfil.sys file is. And the size of the hiberfil.sys depends on how many applications were running and how much data was in memory at the time that the system went into hibernation. For example, if you hibernate your system when you have Word, Excel, and PowerPoint running and files open in each application, the hiberfil.sys file is going to be larger than if you closed all your apps before you hibernate your system. If the hiberfil.sys file is larger, resuming is going to take longer. Even so, resuming from hibernation is generally faster than booting up from a complete shut down.
Knowing that people liked how fast their computers resumed up from hibernation, Microsoft decide the figure out to make the process better.

Hybrid Shutdown

Okay, now we have a good foundation with which to understand how Fast Boot works. While the name Fast Boot implies a faster startup routine, the magic actually begins at shut down using a technique Microsoft has called Hybrid Shutdown. When you select the Shut down command from Windows 8's Power menu, the first thing that happens is that the user session shuts down just like in a regular shut down operation. However, instead of closing the kernel session, Windows hibernates the kernel session. Then, the hardware session shuts down normally.
Shutting down the user session is quicker than hibernating it, which is an improvement over the old hibernation operation. And, hibernating the kernel session is quicker than shutting it down, which is an improvement over the old shutdown operation. So, these two operations combined allow Hybrid Shutdown to shut down Windows 8 faster than previous versions of Windows.

Fast boot


0143.FastBootTitle.jpg
When you turn on the computer, the first thing that happens is the system's firmware boots up and gets the basic computer hardware ready for the operating system. On a modern Windows 8 computer, the establishment of the hardware session is a much quicker operation than on older systems because the UEFI system is much more efficient than the BIOS system. To complete the hardware session, the operating system enumerates all available hardware and loads the appropriate drivers, thus ensuring that a solid hardware session is available.
Once the hardware session is ready, the operating system begins its resume operation. Since the resume operation consists only of restoring the kernel session, rather than restoring both the kernel session and the user session, the resume operation can occur much quicker. In addition to this, the resume operation gets a boost from the fact that the operating system is now designed to take advantage of multiple CPU cores when it comes to processing the hibernation data file. (The old resume process only used one.) If your Windows 8 system is installed on an SSD, you can expect an even more responsive resume operation.

Performing a real shut down in Windows 8

At this point my friend was wondering, if selecting the Shut down command from Windows 8's Power menu performs a hybrid shutdown, rather than a real shut down, how do you get a fresh kernel session - in other words how do you achieve a real cold boot? Well, when you click Restart you will indeed get a full reboot of the system and thus a fresh kernel session.
You can also achieve a real shut down using the Shutdown command line tool. To do so, you can open Command Prompt and type the following command:
Shutdown /s /t 0
If you want to have regular access to a real shut down procedure, you can use this command line in a shortcut.

Sleep and Hibernation modes

In Windows 8, Sleep and Hibernation work pretty much the same as they did in previous versions of Windows. Selecting the Sleep command from the Power menu, essentially pauses the operating system, puts your work and settings in memory and then puts the entire system in a low power consumption state. Pressing any key will instantly revive the system and you can get back to work right where you left off.
While it doesn't appear on the Power menu by default, you can add Hibernate from the Power Options | System Settings screen shown in Figure C. When you do, selecting the Hibernate command puts the system into hibernation mode just like I explained earlier.

Figure C


Fig C 10-25.png

You can add the Hibernate command to Windows 8's Power menu.

0 comments:

Post a Comment

Appreciate your concern ...