在偶遇SetSuspendState函数的时候对于hibernate 和 sleep两者的区别产生疑问
BOOLEAN WINAPI SetSuspendState(
_In_ BOOLEAN Hibernate,
_In_ BOOLEAN ForceCritical,
_In_ BOOLEAN DisableWakeEvent
);
Suspends the system by shutting power down. Depending on the Hibernate parameter, the system either enters a suspend (sleep) state or hibernation (S4).
并不了解 hibernate 与 sleep 的区别,于是网上查找:
休眠(Hibernate),将系统切换到该模式后,系统会自动将内存中的数据全部转存到硬盘上一个休眠文件中,然后切断对所有设备的供电。这样当恢复的时候,系统会从硬盘上将休眠文件的内容直接读入内存,并恢复到休眠之前的状态。这种模式完全不耗电,因此不怕休眠后供电异常,但代价是需要一块和物理内存一样大小的硬盘空间(好在现在的硬盘已经跨越TB级别了,大容量硬盘越来越便宜)。而这种模式的恢复速度较慢,取决于内存大小和硬盘速度,一般都要1分钟左右,甚至更久。