unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Daniel Mendler <mail@daniel-mendler.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 48118@debbugs.gnu.org
Subject: bug#48118: 27.1; 28; Only first process receives output with multiple running processes
Date: Fri, 30 Apr 2021 18:17:49 +0200	[thread overview]
Message-ID: <70ea83e2-fc9e-6feb-240c-ed41abac5254@daniel-mendler.de> (raw)
In-Reply-To: <83bl9vbw8h.fsf@gnu.org>

On 4/30/21 5:58 PM, Eli Zaretskii wrote:
> A call to accept-process-output prioritizes a process only if it
> explicitly requests output from that single process.  Which is not
> necessarily true in all cases.

Yes, I have seen that in the documentation.

>>> What does this mean, exactly?  Which quantity should be doled in a
>>> round-robin fashion? bytes read from the processes? something else?
>>>
>>> If the bytes read, then how do you suggest to handle two processes
>>> which produce output at very different rates?
>>
>> For example bytes read or time spent to handle a process (time spent in
>> the filter function?).
> 
> Bytes read has a problem when processes produce output a very
> different rates.  Time spent to handle may (and usually does) mean the
> filter function does something expensive, it doesn't necessarily tell
> anything about the output from the subprocess.

Of course it is not possible to find a perfect scheduling algorithm. But
how does the OS handle it if you have multiple processes which produce
output with vastly different rates? I am not claiming this problem has
been solved, but there are certainly some heuristics. Emacs is also
dependent on the OS scheduling, depending on how Emacs schedules its
reads/writes from the processes, the OS scheduler adjusts accordingly.
This furthermore complicates the picture.

>> When I stumbled over this issue, it astonished me that Emacs
>> does not seem to do any scheduling at all and handles only a single
>> process.
> 
> If you read the code, you will see this isn't what happens.  What
> happens is that Emacs reads a chunk of output from the first process
> it sees ready, then it goes back and re-checks which processes are
> ready -- and in your scenario I think it again sees that the first
> process is ready.

This is what we assumed. Emacs could check the second process the next
time. This way one may get a slightly more fair behavior. It would
certainly not be perfect and you could throw scenarios at it which would
make it behave unexpectedly. It may behave a bit more expectedly in the
common case?

> I suggest to read the code of wait_reading_process_output, it has some
> non-trivial logic in this department.

I will do that. Has this problem discussed before?





  reply	other threads:[~2021-04-30 16:17 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-30 13:44 bug#48118: 27.1; 28; Only first process receives output with multiple running processes Daniel Mendler
2021-04-30 14:17 ` Eli Zaretskii
2021-04-30 14:23   ` Daniel Mendler
2021-04-30 14:31     ` Eli Zaretskii
2021-04-30 14:26   ` Eli Zaretskii
2021-04-30 14:30     ` Daniel Mendler
2021-04-30 14:34       ` Eli Zaretskii
2021-04-30 14:45         ` Daniel Mendler
2021-04-30 14:59           ` Eli Zaretskii
2021-04-30 15:39             ` Daniel Mendler
2021-04-30 15:58               ` Eli Zaretskii
2021-04-30 16:17                 ` Daniel Mendler [this message]
2021-04-30 18:06                   ` Eli Zaretskii
2021-05-02  7:23                   ` Lars Ingebrigtsen
2021-05-24 21:05                     ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-25 11:38                       ` Eli Zaretskii
2021-05-25 15:18                         ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-25 17:12                           ` Eli Zaretskii
2021-05-25 18:02                             ` miha--- via Bug reports for GNU Emacs, the Swiss army knife of text editors
2021-05-25 19:02                               ` Lars Ingebrigtsen
2021-06-04 13:34                     ` Philipp
2021-06-04 14:00                       ` Eli Zaretskii
2021-04-30 16:15               ` jakanakaevangeli
2021-04-30 17:52                 ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=70ea83e2-fc9e-6feb-240c-ed41abac5254@daniel-mendler.de \
    --to=mail@daniel-mendler.de \
    --cc=48118@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).