DConf 2013 Day 1 Talk 6: Concurrent Garbage Collection for D by Leandro Lucarella

Leandro Lucarella luca at llucax.com.ar
Tue May 21 12:24:02 PDT 2013


Diggory, el 21 de May a las 00:52 me escribiste:
> On Monday, 20 May 2013 at 13:55:05 UTC, Regan Heath wrote:
> >On Mon, 20 May 2013 13:50:25 +0100, Andrei Alexandrescu
> ><SeeWebsiteForEmail at erdani.org> wrote:
> >
> >>On reddit:
> >>http://www.reddit.com/r/programming/comments/1eovfu/dconf_2013_day_1_talk_6_concurrent_garbage/
> >
> >This may be the Windows Copy On Write feature mentioned in the Q&A
> >at the end:
> >http://support.microsoft.com/kb/103858
> >
> >.. but it's not clear to me how useful this is for fork emulation
> >or similar.
> >
> >R
> 
> Fork isn't needed at all really in the technique described, this is
> all that's needed:
> - Map a copy of the memory using copy-on-write
> - Run some code concurrently
> 
> It just happens that fork does both of these things, but you can
> equally well do the two things using separate calls.
> 
> In fact you should be able to avoid the deadlock issue by not using
> fork but just remapping some shared memory using copy on write. The
> GC can exist in a separate thread which pauses itself after every
> run. To run the GC it's then just a case of:
> - stop the world
> - copy registers to stack
> - remap shared memory using COW
> - resume the world
> - resume the GC thread
> 
> And that would work on all modern OSes, plus you don't have the
> overhead of creating a new process or even a new thread. Also
> immutable memory doesn't need to be mapped, the GC thread can access
> it directly.

I'm interested in what you're describing, but I don't know how can you
achieve this without fork()ing (or clone()ing in Linux). What does
"remap shared memory using COW" in a context where fork() doesn't
happen? Why do you even need shared memory if fork() doesn't happen? If
"remap shared memory using COW" means get a different address for the
same block of memory until a write happens in that block, then you can't
scan the roots anymore.

I'm *very* interested in your suggestion.

-- 
Leandro Lucarella (AKA luca)                     http://llucax.com.ar/
----------------------------------------------------------------------
GPG Key: 5F5A8D05 (F8CD F9A7 BF00 5431 4145  104C 949E BFB6 5F5A 8D05)
----------------------------------------------------------------------
CONDUCTOR BORRACHO CASI PROVOCA UNA TRAGEDIA: BATMAN UNICO TESTIGO
	-- Crónica TV


More information about the Digitalmars-d-announce mailing list