The Big Picture: Closing a Shop for the Night

Closing a shop properly means: tell customers to leave, finish serving them, count the till, switch off the machines, lock the door. Closing it badly means walking out mid-sale with the lights on.

A PC does the same. A graceful shutdown lets every program and service finish its work and save its data before the power goes off. This section covers the three things the Start menu offers: Shut down, Restart, and the hidden twist in "Shut down" called Fast Startup.

6.1 Graceful Shutdown Sequence (Services Stop, Processes End)

What it is: When you choose Shut down or Restart, Windows runs an orderly sequence. Section 11 draws the whole chain; here are the key steps.

StepWhat happens
1. RequestYou click Shut down. The request is handled by the logon/session components (winlogon.exe) and a call named ExitWindowsEx
2. Warn programsEach open program gets a message: "the session is ending, please close". Programs can save work or show "Save changes?"
3. Wait or forceWindows waits a short time for slow programs, then offers "Close anyway" (or closes them if forced)
4. Log off the userThe user's session ends; their processes are closed (Chapter 9)
5. Stop servicesThe Service Control Manager tells services to stop, in dependency order (Chapter 12)
6. Flush to diskThe kernel writes cached data to the drive so no file is left half-written (Chapter 19)
7. Power IRPsDrivers are told to power down their devices (Chapter 13)
8. Power offACPI switches the machine to S5 (Section 2)

Why it can take time: a program that does not respond, a service that will not stop, or a large amount of data to flush each add delay. If you see "Waiting for..." on a blue screen during shutdown, Windows is waiting for such an item.

Why a hard power-off is bad: if you hold the power button for several seconds or pull the plug, the flush in step 6 never happens. Files being written can be damaged. Modern file systems (Chapter 19) have a journal that helps repair this, but you can still lose recent work.

6.2 Shut Down vs Restart vs Sign Out

ActionWhat it doesEnds in
Sign outCloses your session only; the PC and services keep runningLogin screen
RestartCloses everything, shuts the kernel down fully, then boots again from scratchNew full boot
Shut down (default)Closes sessions, then may save the kernel (Fast Startup) and powers offS5
Shut down with Shift heldA full shutdown, without Fast StartupS5
Sleep / HibernateKeeps your session (Sections 3 and 4)S3 / S4

Why Restart fixes problems: Restart really clears the kernel and all drivers from memory and loads them fresh. Plain "Shut down" with Fast Startup does not do that (see 6.3). That is why "have you tried restarting?" works, and why "I shut it down and turned it on" sometimes does not.

6.3 Fast Startup (Hybrid Shutdown)

What it is: Fast Startup (also called hybrid shutdown or hybrid boot) is a Windows 10 and 11 feature, on by default on many PCs, that makes the next start quicker.

When you click Shut down with Fast Startup on:

1. All user sessions are logged off, user programs closed   (like a normal shutdown)
2. The KERNEL SESSION is NOT closed. Windows hibernates it:
      kernel + loaded drivers' state  --->  hiberfil.sys
3. The PC powers off (S5)

On the next boot:

power button -> firmware -> boot manager -> sees saved kernel
-> loads it from hiberfil.sys (fast) -> logon screen

So it is a partial hibernate: your programs are not saved (they were closed), but the kernel and drivers are. Reading one file is quicker than starting the kernel and loading every driver one by one, especially on a hard drive.

Full bootFast Startup boot
ProgramsClosedClosed
Kernel and driversLoaded freshRestored from hiberfil.sys
SpeedSlowerFaster
Clears driver glitchesYesNo

Side effects to know:

EffectWhy
A problem survives a "Shut down"The faulty driver state was saved and restored
Uptime in Task Manager can look very longThe kernel session carries over (Chapter 11); a Restart resets it
Some updates seem to waitWindows may need a real restart to finish them
Dual-boot or disk tools may complainThe file system looks "in use" (hibernated) to the other system
Wake-on-LAN or some devices behave differentlyThe PC may be in S5 with the kernel saved

Fast Startup needs hibernation switched on (Section 4). powercfg /a lists "Fast Startup" if it is available. You can turn it on or off in Control Panel → Power Options → "Choose what the power buttons do" (hedge: the option is hidden if hibernation is off). Do not change it in the lab.

6.4 The shutdown Command (Read About It, Do Not Run It in the Lab)

Windows has a command-line tool named shutdown. It is real and useful, but running it ends your session, so the lab does not use it.

SwitchMeaning
/sShut down
/rRestart
/hHibernate
/lLog off
/t secondsWait this long first (/t 0 means at once)
/fForce running programs to close (can lose unsaved work)
/aAbort a pending shutdown (only works during the countdown)
/hybridWith /s, do a shutdown that prepares Fast Startup (hedge: version details)

An example you might see in a script: shutdown /r /t 60 (restart in a minute). Never use /f casually; it closes programs without letting them save.

Safety: Do not run shutdown commands while working through this chapter. Reading them is enough.

6.5 When Windows Restarts for Other Reasons

ReasonDetail
UpdatesInstalling certain updates needs a restart (Chapter 35)
Blue screen (BSOD)A critical error forces a restart
Driver installsSome drivers ask for a restart

Summary

TermPlain meaning
Graceful shutdownPrograms and services finish and save, caches are flushed, then power off
Shut downEnds sessions; with Fast Startup, saves the kernel for a faster next boot
RestartFull shutdown of the kernel, then a fresh boot
Fast StartupHybrid shutdown: partial hibernate of the kernel into hiberfil.sys
Shift + Shut downFull shutdown without Fast Startup
shutdown /s /r /aCommand-line tool (describe only; do not run in the lab)