68.3 Sleep Modes
{#sec:sleep_modes}
20190511
Closing the lid of a laptop, for example, causes the operating system to request the hardware to proceed into some kind of sleep mode. Generally it is a mode known as S3 (suspend to RAM or S2RAM or STR). In this mode most of the hardware consuming power in the computer is turned off or into a state of reduced power consumption. The RAM (the computer’s main memory) retains power so as to retain a copy of the current CPU state. When the computer is awoken, as when the laptop lid is opened, the CPU state is restored from RAM and hence can quickly continue whatever it was previously doing.
To suspend from the command line use -, pm, suspend as root:
Another mode is hibernation which is also known as suspend to disk or STD. Essentially all power is turned off after saving a copy of the CPU state to the disk (hard disk or solid state disk). Again, on resumption the CPU state is restored to the CPU though this may take a little more time than when restoring from RAM.
From the command line the computer can be put into hibernation using -, pm, hibernate as root. Not all platforms support hibernation:
In newer Linux systems the systemd daemon is the first process that starts after a system boots and the last when a system shuts down. It can be used to manage sleep too.
Some other interesting commands include:
$ cat /sys/power/state # Available sleep states
freeze mem disk
$ cat /sys/power/mem_sleep #
[s2idle]
$ cat /sys/power/disk #
[platform] shutdown reboot suspend test_resume
$ sudo sh -c 'echo "disk" > /sys/power/state' # Suspend to disk?
For reference: * *
Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0