emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs design and architecture. How about copy-on-write?


From: Eli Zaretskii
Subject: Re: Emacs design and architecture. How about copy-on-write?
Date: Wed, 20 Sep 2023 18:53:27 +0300

> From: Po Lu <luangruo@yahoo.com>
> Cc: Emanuel Berg <incal@dataswamp.org>,  emacs-devel@gnu.org
> Date: Wed, 20 Sep 2023 21:35:49 +0800
> 
> Po Lu <luangruo@yahoo.com> writes:
> 
> > Ihor Radchenko <yantar92@posteo.net> writes:
> >
> >> Does it mean that each threads contains a copy of the whole `globals'? I
> >> think I proposed this in the linked thread and it was objected as
> >> something taking a lot of memory.
> >
> > It incorporates one pointer for each field within globals itself.  AFAIU
> > that was the initial impetus for introducing struct emacs_globals in the
> > first place.
> >
> >> IMHO, copy-of-write would be better here - only store the thread-local
> >> values that are actually altered by the thread.
> >
> > Of course only specbound values will be saved within each thread's
> > state, but each thread must maintain a pointer to the field that is
> > actually holding the value of the forwarded variables.
> >
> >> Indeed, a simple #define will not be enough then, but we would not waste
> >> memory copying the values that will never be changed anyway.
> >
> > On my machine, struct emacs_globals is 7490 bytes, just short of 7 KiB.
> 
> Correction: just over 7 KiB.

And don't forget that the globals defined in globals.h are just those
we define in C.  There are many globals defined in Lisp.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]