From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: Opportunistic GC Date: Wed, 10 Mar 2021 20:25:04 +0000 Message-ID: References: <83tuplr2l8.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="3879"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org, Stefan Monnier , Andrea Corallo To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Mar 10 21:28:01 2021 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 1lK5R2-0000uT-Ei for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Mar 2021 21:28:00 +0100 Original-Received: from localhost ([::1]:53932 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lK5R1-0000P7-Gz for ged-emacs-devel@m.gmane-mx.org; Wed, 10 Mar 2021 15:27:59 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:33182) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lK5Or-0006kU-GJ for emacs-devel@gnu.org; Wed, 10 Mar 2021 15:25:46 -0500 Original-Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]:38735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lK5Op-000524-7M; Wed, 10 Mar 2021 15:25:45 -0500 Original-Received: by mail-ot1-x335.google.com with SMTP id a17so17734722oto.5; Wed, 10 Mar 2021 12:25:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=vlMp/B5HlxIq96hnph5euNg0BKbGaTX6LdxBcdpT6fs=; b=KmJoFg4Q1Fp3BXvBqwPEUi86p6LaJg1RQ5WY+OQUZoWRYdu5CeX3wWsDuavhVyCrB9 ZF7u/a3AfX4l/zAcJwRkWOPK9yrMj9BU5P62bKVUpMjIq5VXJUTa+WbyK6yzwPcDJ7Dd aErW1KH6xD69vTPTTCaA5vC95eYYE0c8XHy7j/aNip/TtqjfYNByuiawkViwspJ2dQxf N98bE6k9KXq0q3k82IuGsi993w78IADxsHfzDDz9Zh6aJD2fWb+gVPtqxpexzUguhsRJ /cqbgH0IiBOMcuri2bgUDRID8KfPDen2VQAsKDNXHTrAYAANiBDFFK2jti6MiwUKM+OV seKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=vlMp/B5HlxIq96hnph5euNg0BKbGaTX6LdxBcdpT6fs=; b=TYe39eMXbQYczb5l8uW1AYKjNEXzfdw+jA1J/g6BeORtiJTcIUhQsFGpMV+AWaRabO FfGWc3W3s1UBvwv76T8sDgM31vbp3xVekfkn/ayGkOeJ/zi3wr0QilNj3dOOnGHY5XM2 9BxaAmnYscTchtXYCdicOOleVDhTMAgWtqzHMBrkPPwd5DHMkqrm2ShQL5u4rl2NfsPP SuazUeGnnkeHuStqKC7EbqKdA80hfOxT1RRw5eL7t80EEcKwku1PvEvSdOH4cVYR+g5Y RQXpDhNjsHEQC941hMQ82CT1tm2ItPIN6Pz7FwRpXx8I+4dpzYLjWZ/pTXhf7Gl7tMfC UkPQ== X-Gm-Message-State: AOAM532IS3JPxaB1izU/4YW+fTaIwh/oWGNTwt+mv7E00znFLrNl0gWM Nq6W53MuIwK72eaZrG21rVNrtTSK68WR03mJTDsEvokIAws= X-Google-Smtp-Source: ABdhPJw7ao+/uCA+D0jqe2P/zB4EMgMXKZK1LaydleT0GGSx7sexjevIEKkRWzMR9N/q1gXBtBVJEdv3SuGadFX26l0= X-Received: by 2002:a9d:6e8d:: with SMTP id a13mr3907947otr.287.1615407940831; Wed, 10 Mar 2021 12:25:40 -0800 (PST) In-Reply-To: <83tuplr2l8.fsf@gnu.org> Received-SPF: pass client-ip=2607:f8b0:4864:20::335; envelope-from=pipcet@gmail.com; helo=mail-ot1-x335.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.23 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" Xref: news.gmane.io gmane.emacs.devel:266302 Archived-At: On Mon, Mar 8, 2021 at 5:13 PM Eli Zaretskii wrote: > > From: Stefan Monnier > > Cc: Pip Cet , eliz@gnu.org, emacs-devel@gnu.org > > Date: Mon, 08 Mar 2021 11:44:05 -0500 > > > > > I also expect fork will work, I'm more wondering about interaction with > > > sockets file descriptors or anything else in our codebase and/or in > > > libraries we have loaded. > > > > I suspect we wouldn't want to use `fork` literally, but rather something > > like Linux's `clone` so as to have more control about what is > > really shared. Basically, we just want to spawn a thread, except it runs > > in a snapshot of the heap. > > There are other potential complications with this, related to > threads. Posix says 'fork' only copies a single thread, the one that > called it, but what if that single thread is not the main thread? Why would that be a problem? I think everything would work just fine in that case, but maybe I'm missing a problem that should be obvious to me. > In > Emacs nowadays a non-main Lisp thread can trigger GC. What happens to > the mutexes we use in the threads machinery when we fork like that? In the child, they're irrelevant, because we'll never return from the function that triggered GC, or allow signal handlers to run; in the parent, they remain valid. Everything should be fine... Pip