GNU logs - #57196, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#57196: 28.1.90; An idea to allow background (low-priority) threads
Resent-From: Ihor Radchenko <yantar92@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Sun, 14 Aug 2022 04:12:02 +0000
Resent-Message-ID: <handler.57196.B.16604502917483 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 57196
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 57196 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.16604502917483
          (code B ref -1); Sun, 14 Aug 2022 04:12:02 +0000
Received: (at submit) by debbugs.gnu.org; 14 Aug 2022 04:11:31 +0000
Received: from localhost ([127.0.0.1]:35571 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1oN4yI-0001wc-KC
	for submit <at> debbugs.gnu.org; Sun, 14 Aug 2022 00:11:31 -0400
Received: from lists.gnu.org ([209.51.188.17]:57738)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <yantar92@HIDDEN>) id 1oN4yD-0001wS-TM
 for submit <at> debbugs.gnu.org; Sun, 14 Aug 2022 00:11:29 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:35044)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oN4yD-0001xh-Ou
 for bug-gnu-emacs@HIDDEN; Sun, 14 Aug 2022 00:11:25 -0400
Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]:41675)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <yantar92@HIDDEN>)
 id 1oN4y9-0001ZQ-My
 for bug-gnu-emacs@HIDDEN; Sun, 14 Aug 2022 00:11:25 -0400
Received: by mail-pj1-x102e.google.com with SMTP id
 t2-20020a17090a4e4200b001f21572f3a4so4208724pjl.0
 for <bug-gnu-emacs@HIDDEN>; Sat, 13 Aug 2022 21:11:21 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:message-id:date:subject:to:from:from:to:cc;
 bh=xzLtSQKIjtohDfUE0vp4ZJ5HCVWKQz0KJQVoB8wUcWE=;
 b=BpzKSum2bOwnIhMWQ2Dw+bhorGU2EFs6hUJw9mbBDhg3tpGLn5Ghq+LoQsy+ZGNx7Y
 +rZKMBT0anj8bL7SHmKdgCfn1iIJcAeFQbB6iby/PbED8lCA8bHwrRPPJxyhm1UZZwQ7
 SgGQf4P+uZ3JWoiN+49MRIayVkMTwH+k5KGylVL5tSI3LobWLsiaj4LPifhdHwn+sNvA
 p6NolKyoogAZ8WxDRsBvldcgWyXRtUysgCXu+I8BkyXXdYV3LYiBEuHPSNPcsd2hNbfn
 zUo5RxA5StfEqhCxTJw3trNvn67X8Svmf+x5k9hsgdjb/tuDj2ejU6E2MNK6cdP5/l7x
 uzJg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=mime-version:message-id:date:subject:to:from:x-gm-message-state
 :from:to:cc;
 bh=xzLtSQKIjtohDfUE0vp4ZJ5HCVWKQz0KJQVoB8wUcWE=;
 b=m+Fwd6atXPEv0TweHR1y2dbjWZ9jEzCdt2eDi4rwacyTFU3RB9LplnLKtr3qXrnsLI
 ppzUjklSAPt2Ggg3ZRke3tMsyFWZcQULDBUq8WKTfvnJzkqqd4g5LuPCpl8HHAQjFO2d
 S5V5BkmIp/HpWofm765wdPsJ4w3PXLUpNv1LNKikw/tdbvsHG/dbfQuatygh3R8tLJkR
 cCBas/NixNkdpWYnT7EPu/lNf4ho9Ois+ZnR5b7yCCjEyQWQMkEkhqee0CJG8814+KEH
 KEmNt4A4xSulcZpAKBZ6HH6EEmB71vgdQlhXjqjUXWplTqsWFhnofmsJN1BvKlB8ge2A
 Ggvg==
X-Gm-Message-State: ACgBeo0VxHj1pkTJ9JHMxLpSW7rnTxNwMmus3yr8xnnCTfO89Ad49kv1
 Wp9XDrsPmPgRmkTDV0pFUdlrN3wMZiF6rA==
X-Google-Smtp-Source: AA6agR67xI3oEVlq0cXy6sEcs55uRpfEeZcjPqUvWUqaHdLo1ehf9LwufhUN6ONG+z9ld0Yel1XcwQ==
X-Received: by 2002:a17:90a:9907:b0:1f5:2318:ea6d with SMTP id
 b7-20020a17090a990700b001f52318ea6dmr12172941pjp.163.1660450279836; 
 Sat, 13 Aug 2022 21:11:19 -0700 (PDT)
Received: from localhost ([2409:8a70:2bf:80b0:8ec6:81ff:fe70:339d])
 by smtp.gmail.com with ESMTPSA id
 u20-20020a62d454000000b00534c32592fasm344967pfl.146.2022.08.13.21.11.18
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sat, 13 Aug 2022 21:11:19 -0700 (PDT)
From: Ihor Radchenko <yantar92@HIDDEN>
Date: Sun, 14 Aug 2022 12:12:20 +0800
Message-ID: <878rnr1n17.fsf@localhost>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=2607:f8b0:4864:20::102e;
 envelope-from=yantar92@HIDDEN; helo=mail-pj1-x102e.google.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
 FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -2.0 (--)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

Hi,

Emacs does have a limited concurrency support via Threads, which is,
unfortunately, mostly a toy feature I haven't seen being used a lot.

All my attempts to implement some real functionality using threads
failed because it is very hard to create real-life threads that do not
noticeably block Emacs. Most of the time, Emacs gets quite sluggish,
even if the thread yields frequently.

Such situation sounds similar to what one may get with 1CPU and
multiple processed fighting for the CPU time. This is something that
used to be solved with nice command.

Could something like nice be implemented for Elisp threads?

Or, alternatively, could thread execution be limited in some ways?
I have the approach taken by org-element cache processing in mind.
org-element limits cache processing using the following variables:

(defvar org-element-cache-sync-idle-time 0.6
  "Length, in seconds, of idle time before syncing cache.")

(defvar org-element-cache-sync-duration 0.04
  "Maximum duration, as a time value, for a cache synchronization.
If the synchronization is not over after this delay, the process
pauses and resumes after `org-element-cache-sync-break'
seconds.")

(defvar org-element-cache-sync-break 0.3
  "Duration, as a time value, of the pause between synchronizations.
See `org-element-cache-sync-duration' for more information.")

I imagine that something similar could be done for threads.
`make-thread' could allow some kind of priority setting that will limit
its execution time to comfortable levels, so that the user in main
thread can actually interact with Emacs without noticing anything.

WDYT?

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Ihor Radchenko <yantar92@HIDDEN>
Subject: bug#57196: Acknowledgement (28.1.90; An idea to allow background
 (low-priority) threads)
Message-ID: <handler.57196.B.16604502917483.ack <at> debbugs.gnu.org>
References: <878rnr1n17.fsf@localhost>
X-Gnu-PR-Message: ack 57196
X-Gnu-PR-Package: emacs
Reply-To: 57196 <at> debbugs.gnu.org
Date: Sun, 14 Aug 2022 04:12:02 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 57196 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
57196: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D57196
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems



Last modified: Sun, 14 Aug 2022 04:15:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.