In any major Operating System (OS) distribution, there would be an option to suspend the machine in order to preserve the electricity consumption. It gets significantly important if the machine is running on a limited-capacity battery.
Ubuntu, may suspend or put your laptop to sleep usually under 2 conditions. Either after exceeding a specific idle time or after the laptop lid was closed.
The downside of this sleep or suspend feature is, it might freeze the process that is intentionally being executed by the user.
$ sudo vim /etc/systemd/logind.conf HandleLidSwitch=ignore HandleLidSwitchExternalPower=ignore HandleLidSwitchDocked=ignore LidSwitchIgnoreInhibited=no
Comment anonymously. Login not required.