Re: [dev] Culling all the way down

From: Mattias Andrée <maandree_AT_kth.se>
Date: Tue, 8 Sep 2020 07:58:58 +0200

On Tue, 8 Sep 2020 07:42:21 +0200
Tobias Bengfort <tobias.bengfort_AT_posteo.de> wrote:

> Hi,
>
> On 07/09/2020 09.13, Alexander Krotov wrote:
> > Maybe a better solution is to send XOFF (see
> > https://en.wikipedia.org/wiki/Software_flow_control), but I am also
> > not sure how other programs react to it. They will probably block
> > waiting for the write(2) syscall to return instead of continuing to
> > do work in the background.
>
> Trying this manually had exactly the desired outcome: CPU usage dropped
> to 0. Nice!
>
> On 06/09/2020 09.48, Mattias Andrée wrote:
> > You would just be adding unneeded work and complexity for next to no
> > gain.
>
> Even if there is little gain it might still make sense if the solution
> is simple. This feels like it could be simple, but I am not sure.
>
> Concrete steps:
>
> - dwm sets _NET_WM_STATE_HIDDEN on windows that are currently not displayed
> - st sends XON/XOFF when _NET_WM_STATE_HIDDEN is set
>
> Do you think this would be reasonable or are there potential issues I am
> missing?
>
> tobias
>

This is what I suggested, exception XOFF is SIGTSTP whereas I suggested SIGSTOP.
SIGSTOP will stop the process no matter what, and that's probably what you want,
you want it to stop working entirely even if its not actually printing anything
at the moment. However, in some cases, such as a visualising audio player or a
video player, you would want to suppress output but not stop at output or at all;
this would require some other solution like resizing the terminal to (0, 0) or
sending a string to the program.

Of course, you will have to make this something the program has to opt in for,
otherwise it cause be stopped when this is not desired, which is in most cases
isn't.


Regards,
Mattias Andrée
Received on Tue Sep 08 2020 - 07:58:58 CEST

This archive was generated by hypermail 2.3.0 : Tue Sep 08 2020 - 08:00:07 CEST