65
9
I was going through an article that explained the hibernation procedure in Microsoft Windows. The main points that I get out of it are
- Windows dumps the whole RAM (after processing it maybe) in the
hiberfil.sys
file. - During boot up, the hibernation file is read, and the contents are loaded in the RAM.
My question is when I am usually copying a file of size, say, 1 GB, it takes about 2 minutes to complete.
However, when Windows is writing the hibernation file (during the hibernation procedure), the whole process takes maybe 10-15 seconds. Why is there such a difference in writing speed?
My RAM size is 4 GB. (I am not talking about fast boot technology.)
Benchmarks:
- Copying 1 GB file from Disk 1 to Disk 2 (external): 2.3 minutes.
- Hibernating the system: 15 seconds.
3
I don't know the answer, but I bet if you checked the book Windows Internals "Chapter 13: Startup and Shutdown" it would tell you (If I had the book myself I would check).
– Scott Chamberlain – 2015-03-09T17:26:22.2171Where in that article does it say that all of RAM is stored to disk? – Eric Lippert – 2015-03-09T19:16:39.327
2This is a good question. When hibernation was first implemented in 1998, it wasn't nearly so fast. – Gabe – 2015-03-09T21:45:22.470
22@coder : the NT system make sure hyberfil.sys have it's full space allocated and that the whole file isn't fragmented. In that condition there is no head jumps on the hard drive during the operation. So you will got effective speeds like 150Mo/s. You can recheck what I said with
fsutil
. – user2284570 – 2015-03-09T22:10:54.1231While I realize it doesn't explain everything, you are neglecting the amount of time needed to read the file from the first disk. Depending on how your drives are set up, this may not be concurrent.
You're also neglecting the overhead that Windows adds when copying files in order to give you a valid estimate of how long the copy will take. My experience is that Windows 7 is slower at file copying in general than Windows XP was, unless I use a third party file copier. – trlkly – 2015-03-10T01:49:03.220
3External disk is typically slower than internal disk, too. – Harry Johnston – 2015-03-10T03:46:10.457
@trlkly You can see the difference when copying a file CLI style. – None – 2015-03-10T08:37:35.250
The space for hibernation on the disk is contiguous, so the data can be written in large blocks, with very few "seeks". Most of the time spent in normal disk operations is doing the "seeks". – Daniel R Hicks – 2015-03-10T11:22:40.487
2@EricLippert - it most certainly doesn't store all of RAM, but that still doesn't explain it. I regularly have few gigabytes of active RAM that needs to be stored (VS2013 or Eclipse + few more things take a lot of ram), and they get stored at the speed that seems to me greater than even theoretical write speed of my non-SSD drive. – Davor – 2015-03-10T12:27:05.463
@HarryJohnston : Only MS-DOS based windows can be installed on external hard disks with some tricky manual changes. Windows to go is only for removable flash devices. – user2284570 – 2015-03-11T21:22:31.953
@user2284570: the OP was copying data from the internal disk to an external disk, and using that as a baseline for disk speed. There's nothing to suggest that he is booting from the external disk. – Harry Johnston – 2015-03-11T21:43:51.970
@HarryJohnston : yes, and you know modern USB hard drives achieves speeds around 40Mo/s which is lot of slower. – user2284570 – 2015-03-11T22:19:35.307
@user2284570: yes, that was my point. – Harry Johnston – 2015-03-11T22:33:53.040
@user2284570: Nothing about the NT file system "makes sure hiberfil.sys isn't fragmented". I've had fragmented hiberfil.sys's before, it's very easy to come across them. – user541686 – 2015-03-12T05:31:42.300
just like @trlkly and Harry Johnston said, disks are slow and external disks are even slower. You need to benchmark by copying from RAM to disk like how hibernation do, for example from /dev/urandom or /dev/null – phuclv – 2016-01-06T03:37:05.210