Yes, you can stop your CPU from sleeping by adjusting power settings in your operating system. The CPU itself doesn’t sleep independently—it follows system-wide power states controlled by the OS, so changing when the computer sleeps or idles is what actually prevents CPU inactivity.
Power Settings Control CPU Sleep
The CPU enters low-power states when the operating system directs it to, usually after a period of user inactivity. This is managed through power plans or energy saver settings, not CPU-specific controls. You adjust these settings to keep the CPU active.
On Windows, go to Settings > System > Power & Sleep. Set ‘Sleep’ to ‘Never’ for both battery and plugged-in states. This prevents the system from entering S3 (suspend to RAM) or S4 (hibernate) states, keeping the CPU ready.
macOS Keeps CPU Active via Energy Saver
In macOS, open System Settings > Battery > Options. Adjust ‘Turn display off after’ to a higher number or ‘Never’. While this setting primarily manages the display, it indirectly affects CPU sleep because system sleep often follows display sleep.
To fully prevent sleep, also disable ‘Put hard disks to sleep when possible’ and uncheck ‘Wake for network access’ if you don’t need remote wake-up. Use the command sudo pmset -b disablesleep 1 in Terminal only if necessary, but note that this requires admin rights and can increase heat and power use.
Linux Systems Use Power Management Tools
Most Linux distributions use systemd for power management. To stop the system from sleeping, edit the logind configuration. Open a terminal and edit /etc/systemd/logind.conf.
Change or add these lines:
- HandleLidSwitch=ignore
- HandleLidSwitchExternalPower=ignore
- IdleAction=ignore
- SuspendKeyIgnoreDelay=forever
Then run sudo systemctl restart systemd-logind. This stops the CPU from pausing during inactivity and prevents sleep when the lid is closed.
Alternatively, use systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target to disable sleep states system-wide. This is safe but should be unmasked later if you need sleep functions again.
Applications Can Temporarily Block Sleep
Some software, like video players, screen sharing tools, or download managers, automatically signal the OS to delay sleep during active tasks. This is done through API calls such as SetThreadExecutionState on Windows or caffeinate on macOS.
On macOS, run caffeinate -u -t 3600 in Terminal to prevent sleep for one hour. The -u flag simulates user activity, and -t sets the time in seconds. This is useful for long tasks without changing permanent settings.
On Windows, a script can use PowerShell to temporarily inhibit sleep:
- Open PowerShell as Administrator
- Run:
Add-Type -TypeDefinition 'using System; using System.Runtime.InteropServices; [Guid("12345678-1234-1234-1234-123456789012"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)] interface ISetThreadExecutionState { [DllImport("kernel32.dll")] static extern uint SetThreadExecutionState(uint esFlags); }'; $es = Add-Type -MemberDefinition '[DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint esFlags);' -Name 'Power' -Namespace 'Win32' -PassThru; $es::SetThreadExecutionState(0x80000001) - This blocks sleep until the script ends or the flag is reset
Hardware and BIOS Settings Limit Sleep
Some systems allow disabling sleep states in BIOS or UEFI. Restart the computer and enter setup (usually by pressing F2, Del, or Esc). Navigate to Power Management or Advanced Settings.
Look for options like ‘Suspend Mode’, ‘S3 Sleep State’, or ‘ERP Ready’. Setting S3 to ‘Disabled’ prevents the CPU from entering deep sleep. However, this increases idle power use and may affect battery life on laptops.
ERP Ready, when enabled, reduces power to near-zero when off but does not affect sleep during use. Disabling S3 sleep is rare and not recommended for everyday use due to higher energy use and heat.
When to Allow CPU Sleep
Preventing CPU sleep is useful for servers, downloads, or remote access, but it should be temporary. Continuous wakefulness increases heat, fan noise, and power consumption. It also reduces the lifespan of moving parts like fans and hard drives.
Let the CPU sleep when not in use to conserve energy and maintain system stability. Use temporary wake locks for specific tasks instead of permanent changes.
Table: Power States and CPU Behavior
| System State | CPU Status | Power Use | Wake Time |
|---|---|---|---|
| Running (S0) | Active | 100% | Instant |
| Idle (S0i1-S0i3) | Low-power idle | 10-30% | Instant |
| Sleep (S3) | Paused, RAM powered | 2-5% | 1-3 seconds |
| Hibernate (S4) | Off, data on disk | 0.5% | 10-30 seconds |
| Off (S5) | Off | 0.5% | 30+ seconds |
This table shows how CPU activity and power use change across states. S0i idle states allow background tasks while saving power, making them safer than full sleep for light workloads.
Rule of Thumb: Match Settings to Use Case
Use ‘Never’ for sleep only on desktops running servers or downloads. On laptops, set sleep to 15-30 minutes when plugged in, and allow shorter times on battery. Always allow sleep when closing the lid unless you’re using an external display.
For temporary tasks, use command-line tools like caffeinate or PowerShell instead of changing system defaults. This avoids forgetting to re-enable sleep later.
Check That CPU Is Not Sleeping
To confirm the CPU is active, monitor system logs or use built-in tools. On Windows, run powercfg /lastwake in Command Prompt to see what last woke the system. Use powercfg /sleepstudy to check recent sleep events.
On macOS, run pmset -g log | grep "Wake ' to see wake history. In Linux, check journalctl | grep 'sleep' for recent suspend events.
If the system logs show no sleep events during your active period, the CPU remained awake as intended.
Related
- Does CPU or Memory Slow Down Your Computer?
- High CPU Usage: Does It Slow Down Your Computer?
- Are Sleeping Mats Comfortable?
General information for everyday wellbeing, not medical advice. If something affects your health, sleep or mood for more than a short while, talk to a qualified professional. Read more
Spotted an error? Tell us and we will correct it (corrections policy).