On Monday, 20 May 2013 at 13:55:05 UTC, Regan Heath wrote:
On Mon, 20 May 2013 13:50:25 +0100, Andrei Alexandrescu
<seewebsiteforem...@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.