Windows does a lot of work in the background when you turn off, restart, or log out of your computer. The process ensures all your work and program data is saved before the hardware is turned off.
Windows Controllers for Login Users (On Shutdown)
When you tell the computer to shut down or restart, Windows will first check to see if other Windows user accounts have active sessions. This occurs when you lock your Windows session and log in with another user account before logging out first.
If Windows finds that another user has not logged out correctly, you will see a "Someone still uses this computer" Message. The other user can lose unsaved data in open applications if you restart reboot. It's usually a good idea to stay here and let the other user login, save the job and log out before turning off.
With Windows, you can click "Close Anyway" if you are sure that the other user has no open job to save. This will force the sign the other user account and close all their open applications.
If you are the only signed user, you will not see this message and Windows will go straight to the next step.
Windows tells programs to save their work and close
Before you actually log out of your computer, Windows tells you about all your open programs to save their work and close. This also occurs when you turn off or restart the computer, as it is a necessary part of the shutdown.
Specifically, Windows sends the WM_QUERYENDSESSION message to each open window. It not only closes any open programs. The programs are told to save their work and close, and they can take a moment before they do. Therefore, it may be a little easier to turn off or log out of your computer.
Programs can block the process by saying they need user input from you. For example, an application may have open files that you need to save. You'll see the message "This app prevents shutdown" if an application requests input. An application can also display a custom message here with the ShutdownBlockReasonCreate feature.
If you see this message, click "Cancel", check the program, save your data and close it yourself. If you are able to send data, you can continue by clicking "Shut down anyway" or "Log Out Anyway" instead.
Note that Windows closes other programs when they are ready. So if you have ten applications open and only one prevents you from turning off, you'll only see the only application if you click "Cancel" here. Windows has already closed the remaining nine applications.
In Windows 10, Windows will also remember which application windows you opened and try to open them again when you log in to your computer.
: To stop Windows 10 from opening the latest open programs at startup
Windows logging out
After saying all your open programs to save data and shut down, Windows logs you out. The entire Windows session associated with your user account is over, and no open programs will continue to function as your user account.
Lots of individual actions are about logging out of Windows. For example, the contents of your user account's Windows registry hives are usually stored in memory. When you log out, they are saved to the disk. They will be recharged to memory the next time you log in.
If you only log out, Windows returns you to the login screen so you can log in as another user. If you turn off or restart, Windows will shut down
RELATED: Windows Registry Demystified: What You Can Do About It
Windows Shuts Itself
After Windows completed signing out some users, it just has to turn off. Windows tells about system services and proprietary processes to shut down clean, save all necessary data to disk. Specifically, it sends the SERVICE_ACCEPT_PRESHUTDOWN message to all running services. After the warnings have been warned, they receive a SERVICE_ACCEPT_SHUTDOWN message. The service has 20 seconds to clean and shut down before Windows turns it off.
Windows 10 will also save the state of your Windows kernel to the disk. It's like a partial hibernation. The next time you start your computer, Windows can reload the saved kernel and boot faster and skip the slower hardware processing process. This feature is called "Fast Startup."
Windows also works to apply available Windows updates during the last part of the shutdown process. Windows performs different update tasks during shutdown, before the computer starts and in the background while it is running.
After all, Windows clean will disassemble your solid state drive or hard disk and wait for a "fully ready" signal indicating that all system data has been saved on the physical disk.
RELATED: Shutdown does not completely shut down by Windows 10 (but restarts) All software has been shut down and all your data is saved to disk.
Windows turns off the computer
Finally, Windows sends an ACPI shutdown signal to your computer. This tells you that your computer physically breaks down. The shutdown process is complete.
If you have ever used Windows 95, remember days before the ACPI shutdown signal. Windows showed a message "It is now safe to turn off the computer" at this step, and you must press the physical power switch yourself.
RELATED: Yes, it's ok to turn off the computer with the power button
It works differently than using sleep or hibernation. With sleep, your computer will stay in a very low power mode. With hibernation, the computer saves its entire system status to the disk and resets it when you turn it on again.