[Dlang-internal] Concurrent No-Pause GC Option (idea)

Krzysztof Jajeśnica krzysztof.jajesnica at gmail.com
Thu Aug 25 19:06:15 UTC 2022


On Monday, 22 August 2022 at 18:00:42 UTC, frame wrote:
> I don't know why a fork is necessary. That can be done in a 
> normal background thread also? And it doesn't eliminate the 
> problem that data can be used in another thread after the 
> scanner marked it as free.

AFAIK forking does indeed eliminate the problem of another thread 
using the data after scanner marks it as free.

Forked process does not share address space with the parent 
process (it gets a copy of the parent's address space), so any 
memory accesses done in the application process after the 
`fork()` will not influence the scanning process. If the scanner 
process marks a block as free, then that means it was definitely 
unreachable in the application process prior to the `fork()`, so 
the application process has no way to access the block (apart 
from cases where you hide the pointer from the GC on purpose, but 
that's a problem for almost all GC implementations, not just the 
`fork()` one)


More information about the Dlang-internal mailing list