From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Daniel Mendler Newsgroups: gmane.emacs.bugs Subject: bug#48118: 27.1; 28; Only first process receives output with multiple running processes Date: Fri, 30 Apr 2021 18:17:49 +0200 Message-ID: <70ea83e2-fc9e-6feb-240c-ed41abac5254@daniel-mendler.de> References: <64c194f9-b984-adaa-d5fd-86aa3ed3833a@daniel-mendler.de> <83wnsjc0vd.fsf@gnu.org> <83tunnc0hz.fsf@gnu.org> <83pmybc03l.fsf@gnu.org> <83o8dvbyyz.fsf@gnu.org> <83bl9vbw8h.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5854"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 48118@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Apr 30 18:27:30 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lcVzF-0001PB-Qy for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Apr 2021 18:27:29 +0200 Original-Received: from localhost ([::1]:41194 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lcVzE-00034E-Q4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 30 Apr 2021 12:27:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55444) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lcVqF-0002Qd-N2 for bug-gnu-emacs@gnu.org; Fri, 30 Apr 2021 12:18:12 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:48153) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lcVq6-0001gv-8O for bug-gnu-emacs@gnu.org; Fri, 30 Apr 2021 12:18:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lcVq6-0001NY-3t for bug-gnu-emacs@gnu.org; Fri, 30 Apr 2021 12:18:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Daniel Mendler Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 30 Apr 2021 16:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48118 X-GNU-PR-Package: emacs Original-Received: via spool by 48118-submit@debbugs.gnu.org id=B48118.16197994805293 (code B ref 48118); Fri, 30 Apr 2021 16:18:02 +0000 Original-Received: (at 48118) by debbugs.gnu.org; 30 Apr 2021 16:18:00 +0000 Original-Received: from localhost ([127.0.0.1]:59699 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcVq4-0001NI-5S for submit@debbugs.gnu.org; Fri, 30 Apr 2021 12:18:00 -0400 Original-Received: from server.qxqx.de ([178.63.65.180]:60019 helo=mail.qxqx.de) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lcVq2-0001N3-4t for 48118@debbugs.gnu.org; Fri, 30 Apr 2021 12:17:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qxqx.de; s=mail1392553390; h=Content-Transfer-Encoding:Content-Type:In-Reply-To: MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BsGnEcKcdaN2xAZepPtfvABAJL0pvmjEU9hq49zvY5o=; b=XIBWkH0NADrVJA+ZnnK0LRn+jj e/Mb4/v1TBPx2YY5CM2uJhPbE2gVs3ipBh/3sgx086uMsD3qKPk01AjVcaaqfuO4lgWQXww8Jk7aS 5Aqk3AyjdiFd0RY33FfPB1irmAzu30n3PxvT0uDaSc+Y1EePB/3ND1xMnydVg4Xy/Xl0=; In-Reply-To: <83bl9vbw8h.fsf@gnu.org> Content-Language: en-US X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:205277 Archived-At: 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?