---
title: "休眠（Hibernate）和睡眠（Sleep）的区别"
author: "aerchi"
date: "2013-03-07T09:40:00Z"
tags: []
slug: "hibernate-sleep"
draft: false
lastmod: "2013-04-26T09:09:40Z"
id: 1853994
url: "https://aerchi.iteye.com/blog/1853994"
---

待机（Standby），将系统切换到该模式后，除了内存，&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;电脑&lt;/span&gt;&lt;a href="" target="\_self" style="word-break:break-all; color:rgb(0,153,153); font-size:12px"&gt;&lt;span style="word-break:break-all"&gt;&lt;span style="word-break:break-all"&gt;其他&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;设备的供电都将中断，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;只有内存依靠电力维持着其中的数据（因为内存是易失性的，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;只要断电，数据就没有了）。这样当希望恢复的时候，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;就可以直接恢复到待机前状态。这种模式并非完全不耗电，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;因此如果在待机状态下供电发生异常（例如停电），&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;那么下一次就只能重新开机，所以待机前未保存的数据都会丢失。&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;但这种模式的恢复速度是最快的，一般五秒之内就可以恢复。&lt;/span&gt;&lt;br style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;br style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt; 休眠（&lt;/span&gt;&lt;a href="" target="\_self" style="word-break:break-all; color:rgb(0,153,153); font-size:12px"&gt;&lt;span style="word-break:break-all"&gt;&lt;span style="word-break:break-all"&gt;Hibernate&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;），将系统切换到该模式后，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;系统会自动将内存中的数据全部转存到硬盘上一个休眠文件中，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;然后切断对所有设备的供电。这样当恢复的时候，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;系统会从硬盘上将休眠文件的内容直接读入内存，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;并恢复到休眠之前的状态。这种模式完全不耗电，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;因此不怕休眠后供电异常，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;但代价是需要一块和物理内存一样大小的硬盘空间（&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;好在现在的硬盘已经跨越TB级别了，大容量硬盘越来越便宜）。&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;而这种模式的恢复速度较慢，取决于内存大小和硬盘速度，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;一般都要1分钟左右，甚至更久。&lt;/span&gt;&lt;br style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;br style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt; 睡眠（Sleep），是&lt;/span&gt;&lt;a href="" target="\_self" style="word-break:break-all; color:rgb(0,153,153); font-size:12px"&gt;&lt;span style="word-break:break-all"&gt;&lt;span style="word-break:break-all"&gt;Windows&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;&lt;/span&gt;&lt;a href="" target="\_self" style="word-break:break-all; color:rgb(0,153,153); font-size:12px"&gt;&lt;span style="word-break:break-all"&gt;&lt;span style="word-break:break-all"&gt;Vista&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;中的新模式，这种模式结合了待机和休眠的所有优点。&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;将系统切换到睡眠状态后，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;系统会将内存中的数据全部转存到硬盘上的休眠文件中（&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;这一点类似休眠），然后关闭除了内存外所有设备的供电，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;让内存中的数据依然维持着（这一点类似待机）。这样，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;当我们想要恢复的时候，如果在睡眠过程中供电没有发生过异常，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;就可以直接从内存中的数据恢复（类似待机），速度很快；&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;但如果睡眠过程中供电异常，内存中的数据已经丢失了，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;还可以从硬盘上恢复（类似休眠），只是速度会慢一点。&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;不过无论如何，这种模式都不会导致数据丢失。&lt;/span&gt;&lt;br style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;br style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;正因为睡眠功能有这么多优点，因此Windows Vista开始菜单上的电源按钮默认就会将系统切换到睡眠模式。&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;所以我们大可充分利用这一新功能，毕竟从睡眠状态下恢复，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;速度要比从头启动快很多。而且睡眠模式也不是一直进行下去的，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;如果系统进入睡眠模式一段时间后（具体时间可以设定）&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;没有被唤醒，那么还会自动被转入休眠状态，并关闭对内存的供电，&lt;/span&gt;&lt;wbr style="word-break:break-all; color:rgb(141,141,141); font-size:12px"&gt;&lt;span style="color:rgb(141,141,141); font-size:12px; line-height:21.59375px"&gt;进一步节约能耗。&lt;/span&gt; &lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;&lt;/wbr&gt;