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

Vladimir Panteleev vladimir at thecybershadow.net
Fri May 24 00:48:48 PDT 2013


On Thursday, 23 May 2013 at 23:49:20 UTC, Diggory wrote:
> You'd either have to distribute a separate .exe for the GC 
> process or embed the second .exe inside the first and extract 
> it at runtime to a temporary location, or call the same .exe 
> with some flag which tells it to turn into a GC. None of those 
> options are particularly nice, all of them require significant 
> interference from the GC, it's not just a case of calling some 
> function to start the GC.

I don't know why you say that. The satellite process would be the 
same executable file as the main process, but started with a 
special switch (or environment variable), which will be handled 
by the D runtime. Since the two processes use the same image, the 
executable code will share the same pages in memory, resulting in 
a small overhead.

> This is especially a problem in cases where the runtime can't 
> insert the init handler such as when using WinMain,

When implementing WinMain, you have to call the runtime 
initialization function, which will initialize the GC. GC 
initialization for the satellite process need not exit.

> which you currently have to do unless you want a console window 
> to pop up.

I don't think this is true. Although the image subsystem is 
auto-detected by the entry point you're using (CONSOLE for main, 
WINDOWS for WinMain), you can specify it explicitly using the 
/SUBSYSTEM linker switch (/SUBSYSTEM:WINDOWS).

> Next there's the fact that you have a separate top level 
> process for every D process. This is going to cause problems 
> with security software since you now have to give both 
> processes permissions in order to run.

Sorry? Could you provide an example (with a specific security 
software package)?

> In addition you have to consider the case where one or other of 
> the two processes is paused or killed unexpectedly - you don't 
> want orphaned GC processes hanging around wasting resources.

Why is this an issue? Windows provides simple ways to wait or 
check for a process's termination.


More information about the Digitalmars-d-announce mailing list