Re: DConf 2013 Day 2 Talk 5: A Precise Garbage Collector for D by Rainer Schütze

Benjamin Thaut code at benjamin-thaut.de
Thu Jun 6 13:27:58 PDT 2013


Am 06.06.2013 08:28, schrieb Rainer Schuetze:
>
>
> On 05.06.2013 16:14, bearophile wrote:
>> Andrei Alexandrescu:
>>
>>> http://www.reddit.com/r/programming/comments/1fpw2r/dconf_2013_day_2_talk_5_a_precise_garbage/
>>>
>>>
>>
>> Is this useful to make the GC precise regarding the stack too?
>>
>> http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.19.5570
>
> I was imagining something similar too. The part about multi-threading in
> the paper isn't too convincing, though. Especially the need for GC safe
> points in tight loops to block a thread during collection will not get
> many friends in the D community.
>

I think you don't really need percise scanning which is thread safe. If 
you have one pool per thread, and you can scan the thread local pools 
percisley within the thread that would be enough. Because you would then 
be able to do generational garbage collection for the thread local 
pools. If you have to scan one of (or the) global pool, percise scanning 
of the stacks is not really needed, the old impercises scanning is 
sufficient, you just have to pin those memory blocks you might think are 
referenced from stack memory.

But to be able to actually do thread local pools a bit more then write 
barriers would be needed. For each of the following situations a call 
into druntime would be needed.

1) Creating a shared or immutable object
2) Casting to shared or immutable
3) Assigning a shared, immutable, __gshared global or static variable

If you have these and you are able to percisley scan the stack for the 
current thread only you will then be able to move all of the referenced 
memory from the thread local pool to the global pool if any of the above 
calls happen.

This would mean that most of the time only thread local garbage 
collection would be neccessary and you won't have to stop other threads 
from doing whatever they are doing. Only in rare cases it should be 
necessary to scan the global pool.

Kind Regards
Benjamin Thaut



More information about the Digitalmars-d-announce mailing list