The Big Picture: Closing Up and Opening Up
You have now met every player: ACPI, drivers, services, S-states, hiberfil.sys. This section puts them in one story. Every time you press Shut down and later press the power button, the same long chain runs. Many of its links come from earlier chapters.
Here is the whole chain in two columns. Read each column from top to bottom. The left column is what happens when you shut down; the right column is what happens when you start up.
SHUTDOWN STARTUP
+------------------------------------+ +------------------------------------+
| 1. You click Shut down | | 1. You press the power button |
| (Start menu, Ch 30) | | (standby power, Ch 4) |
+------------------------------------+ +------------------------------------+
| 2. winlogon / ExitWindowsEx | | 2. PSU: PS_ON, then PWR_OK |
| ask apps to close | | ("power good"), Ch 4 |
+------------------------------------+ +------------------------------------+
| 3. User session ends; services | | 3. CPU leaves reset and runs |
| stop in order (Ch 12) | | the firmware (Ch 5) |
+------------------------------------+ +------------------------------------+
| 4. Kernel flushes caches to disk | | 4. Firmware tests hardware, finds |
| (Ch 19) | | the boot drive, starts the |
+------------------------------------+ | boot manager (Ch 5, Ch 6) |
| 5. Drivers get power IRPs and | +------------------------------------+
| power devices down (Ch 13) | | 5. Boot manager and loader load |
+------------------------------------+ | the kernel (or resume the Fast |
| 6. ACPI enters S5 (or saves the | | Startup image) (Ch 6) |
| kernel to hiberfil.sys first) | +------------------------------------+
+------------------------------------+ | 6. Kernel starts drivers, then |
| 7. PSU standby power only | | services (Ch 12, Ch 13) |
+------------------------------------+ +------------------------------------+
| 7. Logon screen; your session |
| starts; desktop appears (Ch 6) |
+------------------------------------+
The sections below walk through each part.
11.1 Shutdown Request: Session Manager Notifies Apps
What it is: The first link is a request from you (or from Windows itself, for example after an update).
- You choose Shut down from the Start menu (Chapter 30 describes the shell).
- The request goes to the logon and session code. A program-visible call,
ExitWindowsEx, starts the process. Windows also sends a message to every top-level window: "the session is ending". - Each program gets a chance to save its work. Programs that do not answer in time are listed in the "These apps are preventing shutdown" screen.
- When all user programs have ended, your session closes (Chapter 9: its processes end; Chapter 24: your logon session is torn down).
This is user mode work (Chapter 8): ordinary programs and services doing ordinary tasks.
11.2 Services Stopped in Dependency Order
What it is: Windows services (Chapter 12) are background programs that started at boot. They must also be stopped in the right order.
- The Service Control Manager sends a stop request to each service.
- A service that depends on another stops first. For example, a service that needs networking stops before the networking service does. The order is the reverse of how they started.
- Services have a time limit to stop. A service that does not stop in time may be ended by force. A long wait here is a common reason for a slow shutdown.
11.3 Kernel Session Terminated (or Hibernated for Fast Startup)
What it is: Now the kernel (Chapter 8) takes over.
| Step | What it does |
|---|---|
| Flush | Cached file data and file-system information are written to the drive so the disk is consistent (Chapter 19). The drive's own cache is also flushed (Chapter 20). |
| Close | Remaining system processes end and the kernel stops its subsystems |
| Branch | Shut down or Restart: the kernel session ends. Fast Startup (Section 6): the kernel session is saved to hiberfil.sys instead of being thrown away |
Shut down + Fast Startup ON --> kernel + drivers saved in hiberfil.sys -> S5
Restart, or Shift+Shut down --> kernel session discarded -> S5 or reboot
11.4 Power-Off Signal to the PSU Through ACPI
What it is: The last link is hardware.
- The Power Manager sends power IRPs down every device's driver stack (Chapter 13). Each driver puts its device in D3 (Section 8).
- Windows calls
acpi.sys(Section 1), which runs the firmware's method (an AML method in the DSDT, Section 1.2) that enters S5. The chipset writes the sleep-type value to a special register. - The motherboard drops the PS_ON signal (the green wire from Chapter 4). The PSU switches its main rails (+12, +5, +3.3 V) off.
- Only the standby rail (purple, +5 V standby) stays on: the power button, Wake-on-LAN and the clock circuits are still alive.
The fans stop and the lights go off. That is S5.
11.5 Startup: The Reverse of Chapter 6's Boot Chain
What it is: Startup is nearly a mirror image. Chapter 6 told the boot story from the firmware onwards; here we add the electrical start.
| Step | What happens | Where you learned it |
|---|---|---|
| 1. Power button | The button is a switch on the standby circuit; pressing it tells the board to start | Chapter 4, Section 5 |
| 2. PSU turns on | The board pulls PS_ON low (to ground); the PSU starts its main rails; when stable, it signals PWR_OK ("power good") | Chapter 4, Section 1.4 and 5.1 |
| 3. CPU reset ends | The CPU is held in reset until power is good, then starts running firmware code | Chapter 5 |
| 4. Firmware | UEFI initialises hardware (POST), builds the ACPI tables (Section 1.2), picks the boot drive and starts the boot manager | Chapter 5 |
| 5. Boot manager and loader | They load the Windows kernel, or restore it from hiberfil.sys (Fast Startup), or resume a full hibernation (Section 4) | Chapter 6 |
| 6. Kernel | Starts the Power Manager, loads drivers, starts the ACPI driver and the system services | Chapters 8, 12, 13 |
| 7. Logon | The logon screen appears, you sign in, and the desktop loads | Chapter 6, Chapter 24 |
The differences by case:
| Case | Starts from | Notable difference |
|---|---|---|
| Cold boot (from S5, no Fast Startup) | The beginning | Everything is loaded fresh |
| Fast Startup boot | S5 plus saved kernel | Kernel and drivers come from hiberfil.sys |
| Resume from hibernate (S4) | S4 | All of RAM comes back; apps return |
| Wake from sleep (S3) | S3 | No boot at all; the firmware only restarts the CPU |
| Modern Standby wake | S0 low power | Nothing is restarted |
11.6 One Timeline Per State
S3 sleep wake key -> CPU restarts -> drivers wake -> screen on (~1-3 s)
S4 hibernate wake button -> firmware -> loader -> read file -> apps (longer)
Fast Startup boot button -> firmware -> loader -> restore kernel -> logon
Full boot button -> firmware -> loader -> kernel -> services -> logon
Look at your own machine: Task Manager → Performance → CPU (Chapter 11) shows Up time, which tells you whether you do full restarts or rely on Fast Startup.
Summary
| Step | One-line meaning |
|---|---|
| Shutdown request | Apps are asked to close and save |
| Services stop | In reverse dependency order (Chapter 12) |
| Kernel flush | Caches written to disk (Chapter 19) |
| Power IRPs | Drivers put devices into D3 (Chapter 13) |
| ACPI S5 | acpi.sys runs the firmware method; the PSU main rails go off |
| Standby power | The only power left; wakes the PC on the button |
| Startup | Power button, PS_ON/PWR_OK, CPU reset, firmware, loader, kernel, services, logon |
| Fast Startup | Replaces the "kernel" part of the boot with a restore from hiberfil.sys |