emacs-devel
[Top][All Lists]
Advanced

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

Re: Concurrency via isolated process/thread


From: Po Lu
Subject: Re: Concurrency via isolated process/thread
Date: Mon, 10 Jul 2023 20:13:50 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Ihor Radchenko <yantar92@posteo.net> writes:

> I see.
> AFAIU, we can then raise a flag that GC is necessary, so that other
> threads will stop next time they reach maybe_gc, until GC is complete.

What if even one of those other threads never calls maybe_gc?  This can
easily happen if they are blocked by a long running operation (domain
name resolution comes to mind) and will result in all threads waiting
for it to complete, defeating the purpose of having threads in the first
place.

TRT on GNU and other Mach based systems (OSF/1, OS X, etc) is to suspend
all other threads using `thread_suspend' and then run GC from whichever
thread is the first to discover that the consing threshold has been
exceeded.  Unix systems typically provide other platform specific
functions to suspend threads or LWPs.

As a consequence of this approach, GC can take place even if those other
threads hold pointers to relocatable string data and buffer text.  I've
experimentally verified that this is rare, and that not compacting
string blocks which are referenced from the stack or in registers
doesn't significantly affect string data fragmentation.


reply via email to

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