0

On GNU/Linux I can send the SIGSTOP signal with $ kill -STOP Then I can send SIGCONT to activate it again,

That saves CPU performance from being used up like 11% from a minimised Firefox window "Isolated Web Co"

 
     PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND
   28112 test     20   0 2824208 337744 126840 S  11.3   2.1   0:14.89 Isolated Web Co

Has any desktop user interface integrated a way to send SIGSTOP to a process thread tree in order to reduce CPU load on minimized processes/threads?

I'd obviously not do this on my Minimised Spotify I'm listening too!

So this behavor would be

  1. Right click on title bar, select "minimise and stop"
  2. When clicking on the icon on the task bar (eg in GNOME Classic) the application would be sent the SIGCONT and the window maximised again.

This is the current GNOME Classic context menu items

I'd like to have another "Minimise & Pause". That would send the SIGSTOP commm

2 Answers 2

0

Stopping interactive processes is a terrific way to break users' functionality expectations, because modern desktop applications do integrate through message buses tightly with the rest of the desktop environment. So, as tempting as your approach sounds, it's going to be a bad idea in practice. Not to mention that you really can't have an X window stop responding...

So, no, I don't think there's such a hack in any desktop environment I'm aware of.

Note that it's your browser that does something for you there - the right thing would be to approach what it's doing and make that stop specifically, if it's no use to you. I suspect it is - for example, a chat client in a browser tab might need to continuously receive and send status messages from a server, or your online word processing tool is not supposed to run out of sync, or your cache is being compressed or such.

Such backround jobs often are assigned low priorities by the software designers anyway (no idea whether that's the case here), and hence usually are only run when there's nothing better to do for your CPU. In other words, they would not significantly impact the performance. They might still consume power and thus reduce battery-supplied runtime, mostly because they might stop the operating system from putting a CPU core to sleep completely.

While that is still somewhat undesirable, you'd want to compare the actual impact to the negative effect that suspending/awakening the process might have (re-establishing all the TLS connections that got severed due to timeouts in TCP, large amounts of en-block data transfer at a time where high transmit power is needed by the WiFi card for high data rates, the simple fact that in the time that happens, you will have to wait, which means you're looking at a maximum brightness screen for longer - all effects that can eat into the energy savings!)

5
  • Marcus, thank you for going into such detail. Perhaps applications such as Firefox could even add their own button to the UI to reduce CPU load and go into the background. Perhaps even limit it to max 0.1% CPU, but leave it active, that would keep any connections active and stop X thinking the window had stopped responding. Chrome uses around 3% when minimised with only a few wikipedia pages, this stack exchange and a paused youtube video. It's a shame really, that no one has figured out an easy way to limit CPU load when not needed
    – rich
    Commented May 24, 2023 at 20:31
  • Linux operating systems do that by default already. You'll want to research what cgroups2 and the cgroups2 CPU controller do. Commented May 24, 2023 at 21:15
  • Thank you Marcus
    – rich
    Commented May 26, 2023 at 21:36
  • When you suspend your PC the kernel does exactly that and nothing breaks. Yes, connections may break (time out), etc. etc. etc. but people mostly have static webpages open. Commented May 31, 2023 at 22:21
  • Not sure how a website being static helps with a browser not being responsive to any window events. Obviously, suspending a PC tenders it inoperable for the time it's suspended... Nobody wants to focus a window on a suspended PC. Commented May 31, 2023 at 22:44
0

killall -SIGSTOP firefox-bin works here just fine. I've not observed any side effects.

You can create a desktop shortcut to stop and resume Firefox if you like.

SIGCONT to resume.

1
  • Thank you Artem. That's a good tip, some shell scripts on the desktop to Continue firefox-bin too
    – rich
    Commented May 31, 2023 at 19:53

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .