Exploring power-saving modes in Linux

When a system is in the idle state and does not have work to do, it can be put in a sleep state to save power. Similar to human sleep, it cannot do anything until it is woken up by external event, for example an alarm clock.

Linux supports multiple sleep modes. The choice of sleep mode and the amount of power it can save depends on the hardware support and the time it takes to enter the mode and wake up from it. 

The supported modes are as follows:

  • Suspend-to-idle (S2I): This is a light sleep mode that can be implemented purely in software and does not require any support from the hardware. The devices are put into low-power mode and time keeping is suspended to let the processor spend more time in a power-efficient idle state. A system is woken up by an interrupt from any of the peripheral devices.
  • Standby: This is similar to S2I, but provides more power saving by taking all non boot CPUs offline. Interruption from some devices can wake the system up.
  • Suspend-to-RAM (STR or S3): All components of the system (except memory), including CPUs, go into low-power mode. The system state is maintained in memory until it is woken up by an interrupt from a limited set of devices. This mode requires hardware support.
  • Hibernation or suspend-to-disk: This provides the greatest power saving, since all the system components can be powered off. When entering this state, a snapshot of the memory is taken and written to persistent storage (disk or flash). After that, the system can be turned off. As part of the boot process, on wake up, the saved snapshot is restored and the system resumes its work.

In this recipe, we will learn how to query the sleep modes supported on a particular system and how to switch to one of them.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.133.121.160