Thread GC non "stop-the-world"

Oscar Martin via Digitalmars-d digitalmars-d at puremagic.com
Wed Sep 24 13:15:51 PDT 2014


On Wednesday, 24 September 2014 at 08:13:15 UTC, Marc Schütz 
wrote:
> On Tuesday, 23 September 2014 at 18:39:09 UTC, Oscar Martin 
> wrote:
>> On Tuesday, 23 September 2014 at 01:58:50 UTC, Rikki 
>> Cattermole wrote:
>>> Short, I dislike pretty much all changes to __gshared/shared. 
>>> Breaks too many things.
>>> Atleast with Cmsed, (I'm evil here) where I use __gshared 
>>> essentially as a read only variable but modifiable when 
>>> starting up (to modify need synchronized, to read doesn't).
>>>
>>
>> Yeah, these changes break many things, and so are not suitable 
>> for D2. My intention was only to point out how expensive is 
>> for the GC to deal with shared memory.
>>
>> Come to think a little more: what if each thread can have its 
>> own GC, but by default all use the current GC (this would 
>> require minimal changes to druntime). "__gshared", "shared" 
>> and "immutable", continue as now, which does not break 
>> anything. If I as a programmer take care of managing (either 
>> manually or through reference counting) all of the shared 
>> memory ("__gshared", "shared" or "immutable") that can be 
>> referenced from multiple threads, I could replace in my 
>> program the global GC by a indiviual thread GC
>>
>> I'll try to implement a GC optimized for a thread and try that 
>> solution
>
> There can also be a shared _and_ a local GC at the same time, 
> and a thread could opt from the shared GC (or choose not to opt 
> in by not allocating from the shared heap).

Yes, a shared GC should be a possibility, but how you avoid the 
"stop-the-world" phase for that GC?

Obviously this pause can be minimized by performing the most work 
out of that phase, but after seeing the test of other people on 
internet about advanced GCs (java, .net) I do not think it's 
enough for some programs

But hey, I guess it's enough to cover the greatest number of 
cases. My goal is to start implementing the thread GC. Then I 
will do testing of performance and pauses (my program requires 
managing audio every 10 ms) and then I might dare to implement 
the shared GC, which is obviously more complex if desired to 
minimize the pauses. We'll see what the outcome


More information about the Digitalmars-d mailing list