1

What happens when a computer goes to sleep? Should I sleep my computer or should I power it down? Is there an appropriate use for each mode or is it just a matter of personal preference?

2

2 Answers 2

4

I'll cover the three common states of a machine: sleep, hibernation, and powered off.


Sleep Mode

Sleep mode is essentially like taking a nap. Your computer is still on, but it is in a low-power state. It will consume less power and often disable hardware and suspend software to assist in reducing power consumption. This often involves disabling USB, PS/2, S/PDIF, audio, video, and other ports. Certain pieces of hardware, such as a wireless card, could also be disabled during this time.

The current session is stored in memory (RAM) and then the memory is placed in a low-power state. The memory still requires a current as otherwise it will decay and the session would be corrupted or lost entirely. During this time, the CPU is not executing any instructions; the storage mediums are also not doing anything.

When you resume the session (often by pressing the power button, moving the mouse, or tapping a key on the keyboard), the system immediately re-enables all of the previously disabled hardware and is pretty much ready to go. There will be a one or two second wait on any modern machine, but that's hardly anything to complain about.


Hibernation

Hibernation is a slower, prolonged version of sleep. It writes the contents of memory and other critical instructions for the system to resume the session to disk and then powers off the machine properly. This is not to be confused with sleep mode, as while hibernating the computer could be unplugged and moved around and still preserve the session. This is safer than sleep mode, but obviously when you turn the machine back on, it is going to have to go through power-on self-test (POST) and then restore RAM contents from disk. It does not, however, have to boot the OS again. And just as with Sleep mode, when it comes back up all the programs you had open will still be open and in the state you left them in.


Shutting Down

Powering a machine off is pretty obvious. In Windows (and other operating systems), a check is made to ensure that other users are not logged in and whatnot. Applications are also informed that the system is shutting down and can possibly stop the shutdown from occurring if something needs attention. Afterwards, the system logs out the users and then the system begins to "unload" critical system components that the operating system needs to run in the first place. After all of that has wrapped up, the operating system halts the machine; in other words, it stops power reaching the components in a safe manner.


Hybrid Sleep Mode

I would like to note that there is a "hybrid sleep mode" that basically combines both hibernation and sleep mode properties. The system will do both actions: write the instructions to disk and store them in memory and place the machine in a low-power state. However, in the event of power loss, the machine can just be turned on again properly and the session will be resumed. If the machine doesn't lose power, then the session should restore as if it was in sleep mode.


Security (of Sleep Mode)

EDIT: this was suggested in a comment. Thanks!

Another concern you might have is security.

As sleep mode is the only option where the machine is technically on, I'll only talk about that. As well, hibernation should lock the session whenever the machine is resumed anyway, as it requires a restart of the machine and operating system.

Obviously, someone coming along and continuing your session without permission is bad. However, by default on Windows operating systems (on some Linux desktop environments, and probably on OSX too), sleep mode should automatically lock the machine on session resume after a specific period of inactivity. If it isn't set to default (it might be my Windows image that has this), then it's easy enough to go into Power Options and change how Windows/OSX/Linux handles sleep mode.

As mentioned above, it is unlikely your network interfaces are active during the period of sleep. In theory, it would be impossible for any kind of network traffic to interact with your machine as the network interfaces should simply be powered off in the first place. In short, it shouldn't be a problem.

Typically, the only concern here is someone else having physical access to the machine. If you live in an environment where no one else will disturb it (or you don't mind them disturbing it), then there's not much of a security concern with using sleep mode.


What is Best

If you're asking "what is best", then I would argue that nothing is better than a healthy shutdown. Hibernation, while it DOES shutdown the machine, does not do other critical housekeeping measures (such as completely purging memory and killing zombie processes). By properly shutting down your system, you are essentially cleaning out the "gunk" that amasses throughout the life of a session. The longer your session lives (so, the more sleeps/hibernations your computer goes through) is often bad for the performance of the system. I won't delve into that further, though, as it is outside of the scope of this question.

If you just scrolled down to the bottom to read what someone thinks you should use, here you go: be patient and just shut down your system.

4
  • Nice answer. +1 The only thing I can think of to potentially add, since the question includes "which is best", might be security considerations (e.g., unauthorized physical access to a sleeping machine, remote access if it's connected to a network or the Internet).
    – fixer1234
    Jan 4, 2016 at 16:15
  • @fixer1234 A lot of the times, by default, systems automatically lock themselves when they stumble into sleep mode. At least, that's the default behaviour of Windows iirc. Plus, in sleep mode, it's likely that the system's network device(s) are disabled anyway. At least, my connections always break when I resume a session on a Windows machine. I'm pretty sure someone would have figured out the security concerns, but I'll add that in. Jan 5, 2016 at 1:40
  • With an SSD, the time to shut down and boot up is a bit shorter, so the time argument is almost moot between hibernation and shutting down (sleep still wins of course). The question is tagged Windows 7 and that was quick: after "upgrading" to Windows 10, I found the times to be even less. No more "press the power button and go get a cup of coffee."
    – user76225
    Jan 5, 2016 at 2:40
  • @Snowman This question was tagged for Windows 7 specifically, so I answered in the context of Windows 7. While I can agree that a solid state drive would make it faster, the comparison of sleep vs. hibernation is still worthwhile even with the fastest of SSDs. I'd honestly argue that sleep is only useful in those times when you're about to expect to have to quickly get on your computer.. or obviously for people without SSDs. However, do bear note to the zombie processes and other clutter that often generates. This can still cause other hardware bottlenecks. Jan 6, 2016 at 7:10
0

In sleep mode the CPU powers down to it's minimum state, the hard drives are powered off, the screen is powered off, and the USB ports are either powered on or off depending on the BIOS and OS settings (you may want to leave the USB ports powered on so that you can wake up the computer by pressing a key on the keyboard).

The main component that stays powered up is RAM memory - this allows a fast restart because the OS and programs don't have to be reloaded from disk. Also, again depending on the BIOS and OS settings, the system can be woken up by a timed event or by special network packets.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .