Hibernation is supposed to write out RAM contents to disk, and coming back from hibernation is supposed to fill back RAM with saved contents. Why is coming back from hibernation slow, e.g. system is very unresponsive in general for quite some time?
The main cause is disk I/O. Reading and writing to a physical disk is much slower than from RAM. When your computer resumes from disk (hibernation) it also has to power up the components which may cause some slowdown. This is highly dependent on the computer. A SSD will have almost the same resume speed from disk as from RAM. Some computers let you move the mouse around before the ram has been completely filled up again, causing low response times.
Note: Assume you have 8GB of RAM and a SSD with 400MB/s throughput. It will still take 8*1024MB/400MB/s = 20.48s. This is not the same speed as resume from RAM.
Assuming a RAM throughput of 15,000MB/s, the resume time is 0.55 seconds.
It's a tradeoff. Do we pull everything that was in RAM before hibernation back from the disk into RAM all at once, or only a little bit at a time, as needed?
We all know that reading a sector from a spinning disk takes practically the same amount of time as writing that sector to the same spinning disk -- the seek + rotate time. So we might expect that writing information from RAM to disk (on hibernate) would take about the same time as reading that same RAM from disk (resume from hibernate). But it doesn't happen that way, because of demand paging.
If the OS pulled in everything at once, then resume from hibernate would take dozens of seconds, but after that it would act the same as if you had never hibernated at all.
OS programmers typically choose demand paging instead. In other words, the OS pulls only a little bit at a time from disk, as needed. That has the advantage that resume from hibernate takes much less time before it starts responding to the keyboard and mouseclicks. On the other hand, when you use something for the first time after hibernation, there's a small but noticeable delay when the OS finally gets around to loading it up. That happens even when "the first time" you use something may be several minutes after the hibernate. So after resuming from a hibernate (i.e., after you see a screen that appears to be more-or-less identical to the screen just before the hibernate), working with the machine may seem sluggish for a while.
As Synetech pointed out, there's a bit of human psychology also involved: Because the screen turns off right away at the beginning of hibernation, it seems like it shuts down fast. And the user can immediately go on with whatever else you wanted to do. But after a resume from hibernation, the user is trying to do something, and the little delays are annoying because they get in the way of what the user is trying to do.
I know what you mean. It does indeed seem like the HDD LED flashes for a long time after resuming from hibernation.
Some reasonable explanations have been given about delays due to starting up hardware (and driver acceleration?) and fragmentation (you’ll notice that a system fresh from the factory will generally hibernate and resume fairly quickly while one that has been used for some time will be much slower to do so). There are a couple of more explanations for this behavior.
When you hibernate, Windows flushes the RAM to the drive. Despite high speeds for reading RAM and writing to disk (even with a defragmented hibernation file on a big, empty drive), it still takes quite a while to write several gigabytes (you will notice that hibernating and resuming a system with small amounts of RAM is farily fast). The screen goes off quickly, but the drive (and motherboard, fans, etc.) all remain running for a while until it finishes flushing the RAM to disk. (Make sure not to throw a laptop with an HDD around until after it has finished and completely turned the drive off).
You can do some experimental tests to measure the time it takes from clicking Hibernate until the system is powered down, and the time it takes from the moment you see the Resuming Windows screen until the HDD LED stops flashing. They will likely be approximately equal. (Windows does attempt to make it seem like it resumes from hibernation very fast by writing and then reading the kernel and stuff to the hibernation file first, so that it can get back up and running immediately and then continues to load in the rest in the background and as needed until it has all been resumed—you can see this behavior in action because the login screen is shown very quickly.)
Why then does it seem like resuming takes longer. There’s two explanations for this.
It’s psychological. As Dan pointed out, because the screen turns off right away when you hibernate, it seems like it shuts down fast, while you see the entire resume process (opening screen and HDD LED flashing).
It’s paging. Since most people use hibernate instead of shutdown because they want to avoid exiting programs and such so that they can pick up where they left off, it means that when Windows resumes, there are a bunch of programs already running and already consuming memory. Because a significant amount of time has passed since the last time that Windows’ memory-manager checked on the system, it will likely end up doing a bunch of memory swapping since from its perspective, some programs have been dormant for a while and others have become active. This swapping of course takes a while and thrashes the drive for some time.
The end result is likely a combination of factors and interactions between hardware activation, paging, psychology, and fragmentation.
If you are up to it, you can definitively find out (at least on your system) what is the bottleneck by performing a few simple tests such as using Process Monitor to observe drive/file activity while Windows hibernates and resumes to see whether all that thrashing is due to access to