From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: basic questions on MPS Date: Sat, 27 Apr 2024 10:41:37 +0200 Message-ID: <87wmojci4e.fsf@gmail.com> References: <87sez9fhzk.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21054"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: emacs-devel@gnu.org To: Richard Stallman Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Apr 27 10:42:02 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 1s0ddC-0005HY-2B for ged-emacs-devel@m.gmane-mx.org; Sat, 27 Apr 2024 10:42:02 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s0dct-0001cr-UY; Sat, 27 Apr 2024 04:41:43 -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 1s0dcr-0001cO-Pf for emacs-devel@gnu.org; Sat, 27 Apr 2024 04:41:41 -0400 Original-Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1s0dcq-00044d-6E; Sat, 27 Apr 2024 04:41:41 -0400 Original-Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-41adf3580dbso16830975e9.0; Sat, 27 Apr 2024 01:41:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714207298; x=1714812098; 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=DBb1arvfKjrLSggZI0w8J/FX2ohMssIxuMjMn7vJmSg=; b=jb5evMehplyrhM+L16uIqiulGJHh1O3kWKujihT7Tp2NjLEpDHug3vxJXKmXPMb76q 2RjACxPeHxfOUMILwDsOtJiuL5DPbxL0c+cyver1RujK6PmqoHUOzyWoeBwQe7ih45AQ PeWJka9LY+aAM7r0yhMk+YGZeebv4H29xasrhjGMwITZIKyoDm/tz3bSwwqnN3fOrBiW ERkwjjfU+tPEoh0P5T0XrpStnB75iXRKJtDdSmf0bAxHc4EeIl6gdfi7U10KDTPzl6z8 9h1QnFSQHDRALpruAlL4C1sd6VKyu9y8Li1GG5E8YpgeRwelIcJetiliFg3IH/I1PiKa N7YA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714207298; x=1714812098; 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=DBb1arvfKjrLSggZI0w8J/FX2ohMssIxuMjMn7vJmSg=; b=tPnJHJvNKKKXqumanfG2In1eIpIAjAkNTK26JKVWVPtl2QMSD4YBkB9wyOUmXabujY MJZs0F5Sg85+idE74Lx9QoFrtkFv9UwWgy5UnBBroAY1yBy2HU6Dn2O/PHzJ3VXmpaJh 8FXt2kbkHkhOFs+6eFhhCndR5tqRMiY3fAyp/Al0FbwzJ4KlTx0Z9dJFvahhiOveu+zX IwGxUUNjVjZ6EileID/LRPoDku4FpKtoIlRGI/DTglgNAXgBIcb97oh1RrKuIxLTZbr+ HkFr8smBD/V1DQ+8T36J+sNozmmUrFpabqfPtNYOq0kQv9UObDwKNdNjKesAdfJYfind Oi7Q== X-Gm-Message-State: AOJu0YzIfdCdomi524edOG7xzlZ4oSt+WnjSGDwv28tAulOOxm8H8JH2 mXKWTP11b/OwCUSISHaWVhVmjIUB+LgZNKvVawNPAF8kkzVmmrAbNYk5eQ== X-Google-Smtp-Source: AGHT+IGYbXakP6v638SabCjckF4S1A8J0YdXruBSsad/i7L6X2n9AwKorScSq13EzwAWWa1cAKuikQ== X-Received: by 2002:a05:600c:5125:b0:418:f5a:580b with SMTP id o37-20020a05600c512500b004180f5a580bmr1749426wms.18.1714207297980; Sat, 27 Apr 2024 01:41:37 -0700 (PDT) Original-Received: from caladan ([89.107.106.118]) by smtp.gmail.com with ESMTPSA id p9-20020a05600c358900b00419f7b73c55sm25484504wmq.0.2024.04.27.01.41.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Apr 2024 01:41:37 -0700 (PDT) In-Reply-To: (Richard Stallman's message of "Fri, 26 Apr 2024 20:20:27 -0400") Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=eller.helmut@gmail.com; helo=mail-wm1-x32c.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:318179 Archived-At: On Fri, Apr 26 2024, Richard Stallman wrote: > > Can somebody explain what the > > problem with hardware based read barriers could be? > > What is a "read barrier"? The definition from the MPS documentation is this: A read barrier is a block on reading from certain memory locations by certain threads or processes. Read barriers are used for incremental or concurrent garbage collection. For a GC algorithm it is often useful to know the relatively small subset of objects that are accessed (or written to) in a certain time interval. Memory barriers are the mechanism to identify this subset; at least approximately. This can be implemented with hardware or software (or a combination). Hardware barriers use the MMU via syscalls. Software barriers are a data structure that must be updated on every read (or write) operation. This requires compiler assistance or disciplined programmers. > > 3) MPS uses a mostly-copying strategy. Copying works well for > > short-lived objects. For long-lived objects it's not so great. The big > > guys (OpenJDK, V8 etc.) switch to mark-compact or something else for > > older generations. > > Could you explain that statement a little? "Older generations" of > what? A generational GC algorithm partitions objects by age. The subsets are called generations. New objects are allocated in the first generation. After a while, they are moved the second generation or, if they are no longer referenced, they are reclaimed. Those from the second generation are moved to the third and so on. The same idea can be expressed with more colorful words: objects are born in the youngest generation, they live for a while, they are promoted to the next older generation until they die. Generational GCs focus the attention on the young generation. The older generations are scanned much less frequently. A copying GC identifies live objects, copies them to a new region and those that stay behind are reclaimed. This works extremely well for the first generation because many objects are only needed temporarily and don't need to be copied to the second generation. However, some objects are moved to the older generations. E.g. a data structure that starts small but accumulates useful stuff incrementally. Over time it will be come bigger and older. Now, copying this big data structure around for eternity could be problematic. It would be better just to keep it in place. That's what the mark-compact algorithm does. Helmut