18.04 gnome: How to prevent suspend/sleep while IO operation is happening?

Discussion in 'Other Operating Systems' started by mrjayviper, Sep 13, 2018.

  1. mrjayviper

    mrjayviper Member

    Joined:
    Jul 18, 2012
    Messages:
    389
    shouldn't any IO operation prevent this from happening? If this is not automatic, how can I prevent this from happening again?

    From my experience with Windows 10 and OSX High Sierra, this shouldn't be happening.

    Thanks
     
  2. flu!d

    flu!d Ubuntu Mate 16.04 LTS

    Joined:
    Jun 27, 2001
    Messages:
    11,916
    If you have sleep enabled on a Windows or OSX machine it definitely goes to sleep if an IO operation is in progress. It happens to me all the time working on client machines, it's so annoying when I forget to disable sleep before starting the operation.
     
    mrjayviper likes this.
  3. elvis

    elvis Old school old fool

    Joined:
    Jun 27, 2001
    Messages:
    33,804
    Location:
    Brisbane
    Sleep idle is based on user interaction (keyboard, mouse, video playback). There's no way to prevent it based on "IO".

    Why? Because "IO" is ambiguous. Run "tcpdump" or "nicstat" on your network interface on an idle system. What do you see? Lots of network broadcast information that your computer is responding to. You know what that is? It's IO.

    Run "iostat" on your system. Have a web browser idle in the background, a few desktop apps. What do you see? Lots of disk reads and writes. System readahead, swap page writeback, etc, etc. You know what that is? IO.

    It's not 1986 any more, and we don't sit on DOS systems that load up one program in serial and sit idle at all other times. Modern computers are always moving, always doing something. "Don't sleep on IO" means "don't sleep at all". Anyone who admins fleets of Macs and Windows boxes knows this, because those stupid things are always waking up to do tasks, and never sleep properly.

    As my co-worker says, "did you get what you want, or did you get what you asked for?". Think about your problem, not your intended solution. It's more likely that you want your display to sleep, and not your whole system. So on AC power (either a plugged in desktop or a laptop on charge) disable sleep/hibernate, and just make your display turn off. It'll still save some power, and the life of your panel.

    For a laptop on battery, select sleep/hibernate to save battery. But also remember that background tasks will halt when you do this (and nobody with common sense runs long-running background tasks on laptops on battery).
     
    colmaz and mrjayviper like this.
  4. Statitica

    Statitica Member

    Joined:
    Dec 29, 2009
    Messages:
    3,081
    Location:
    Lae, Morobe, PNG
    The other option is to use caffeinate.
     
    mrjayviper likes this.

Share This Page