From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?utf-8?Q?Gerd_M=C3=B6llmann?= Newsgroups: gmane.emacs.devel Subject: Re: MPS: w32 threads Date: Sat, 04 May 2024 16:20:19 +0200 Message-ID: References: <875xvvp3fo.fsf@gmail.com> <87r0eicht1.fsf_-_@gmail.com> <87plu29lcc.fsf@yahoo.com> <87fruyccs8.fsf@gmail.com> <86h6fegdzk.fsf@gnu.org> <86bk5lhqlx.fsf@gnu.org> <86le4pfzjg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40933"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: eller.helmut@gmail.com, luangruo@yahoo.com, emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat May 04 16:21:20 2024 Return-path: Envelope-to: ged-emacs-devel@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 1s3GGN-000AOB-VK for ged-emacs-devel@m.gmane-mx.org; Sat, 04 May 2024 16:21:20 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s3GFY-0001gO-F5; Sat, 04 May 2024 10:20:28 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s3GFW-0001fm-6y for emacs-devel@gnu.org; Sat, 04 May 2024 10:20:26 -0400 Original-Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s3GFT-0001WB-Re; Sat, 04 May 2024 10:20:25 -0400 Original-Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-a59a934ad50so87145266b.1; Sat, 04 May 2024 07:20:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714832421; x=1715437221; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=S3lCT+ckSwdRAe+xMnhFGdcu4/3ypjGSYk81ueWjcRg=; b=aNyYRKG8jwwPb/andufcPn+2WYrqpwhb1E/uxxBTmxWROBGvbDHmT9mUMomAvoJash VpxvVKDHsz087R8CmPt0HXhB6hDDHwjYliF3e8TwMo3TAo4JAhPnDYPquwiVWfltHNgj 9ipRpjUc2O5LjkrtpGGE7CprrYzS1t2ybibYOLVTB8hJx9W+5J4dpuKB2eMFSl1h4DwX x7e1M6QcwNUPtm7Y4AIURrKy+lRMokjJUtIzz1dcTsjYt84A1+S9AD2aJjpwGADUGNSo HKZmN/NX2IfbXQ94r7ly89naNzNUdJm9TDWhqbwgmOKlU1AcDwXZguecQnCcmWn5qzmP Gyag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714832421; x=1715437221; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=S3lCT+ckSwdRAe+xMnhFGdcu4/3ypjGSYk81ueWjcRg=; b=HuC0vlpyqLlcHmfSQ0qQ3/TLhaJJNzemAd/1Z2ocxEtVdfp7fp1HiWpSx2zq/1+9xM XIBnKN/IhXikFZJWD9ai3rb1fHYabnyEGQXpj+Cqxb1eh7MqHk8ORx5hEZFp089JbczT ILK1X8NIVUx+R9ukrX9abSrIVxt2KlZBXThuaSZnn+IoP91rXxsW6D9a9XC8Gtz55nDD clSGqsqW67ijY78rer2sOlaq4eMnbCHLy6TzvJ2p3x0RFRIRJLUbeDGyJwA4E8DHKDsq VAh+GU3t/wrRLb1xW8dn3Lkj43kR40J/cHdJ7boyI+h+U3e9Q1gjadRc0QRHZJt6sZUp x4Qw== X-Forwarded-Encrypted: i=1; AJvYcCUmFMP65rwpCm3N112ulPxWvDkKc+W17+nXGj50byj3rvsxcpcz/i1Pxb45R458+e79AL6Ren3eOWhxxZ5iLdMKLOAW X-Gm-Message-State: AOJu0Yxw1WqtjbrAexfAjtjdFdTTN0++OY/8UgdqqAdyNnaUxAk+WPDo OOKUj+jEFXYeJLa1w2AJ0LOEwFZgVUG6zhlr40AXfnEfKs+UsWwb/+F5jg== X-Google-Smtp-Source: AGHT+IHJfrmQk7jU2Tkkxco7Hzzww/cG23ciqem8a1hI+ApWsJiGeBb0Dc/SU2aOdUw6wINYo5884A== X-Received: by 2002:a17:906:4599:b0:a59:9b52:cfbe with SMTP id qs25-20020a170906459900b00a599b52cfbemr2325099ejc.30.1714832421015; Sat, 04 May 2024 07:20:21 -0700 (PDT) Original-Received: from pro2.fritz.box (pd9e36fc9.dip0.t-ipconnect.de. [217.227.111.201]) by smtp.gmail.com with ESMTPSA id j21-20020a170906051500b00a59291b5551sm2993823eja.63.2024.05.04.07.20.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 May 2024 07:20:20 -0700 (PDT) In-Reply-To: <86le4pfzjg.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 04 May 2024 16:59:47 +0300") Received-SPF: pass client-ip=2a00:1450:4864:20::634; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x634.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:318747 Archived-At: Eli Zaretskii writes: > No. Only Lisp threads started with make-thread have thread_state. OK. (Plus main_thread, which is a thread_state in the data segment (!) for the main thread. Just in case someone wonders why main_thread is a root.) >> A thread must be registered with an arena if: >> >> its control stack and registers form a root (this is enforced by >> mps_root_create_thread()); or it reads or writes from a location in an >> automatically managed pool in the arena. However, some automatically >> managed pool classes may be more liberal than this. See the >> documentation for the pool class. > > Can you try translating this to Emacs-related terms, please? What > activities in the thread should require the thread to be "registered > with an arena"? It basically says that if a thread can have Lisp_Objects or pointers to them on its control stack, register it with MPS. An arena is basically an implementation of some low-level aspects of memory managemnt in MPS. We have only one MPS arena, and it is one using VM functions (mmap, ...). The hint that some pool classes don't require this or that we can ignore. AKAIK the mostly-copying pools we use require it. > Emacs on Windows starts separate threads for the following jobs: > > . processing Windows GUI-related messages > . reading from sub-processes (part of pselect emulation) > . emulation of itimers (for atimers and for M-x profiler) > . file-change notifications > > I need to understand what traits of a thread make it need to be > registered with MPS. Each of the above will then need a separate > audit, I think. Using any Lisp_Objects (or other objects allocated from MPS) -> register it. AFAIU, the GUI thread gets such an objects posted in a message, so that one must be registered. The others are hard to say for me. It would not do harm to register them, but might mean addtional work for nothing.