D GC theory

via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 24 09:07:01 PST 2015


On Tuesday, 24 February 2015 at 16:05:06 UTC, Marc Schütz wrote:
> On Tuesday, 24 February 2015 at 15:14:03 UTC, Ola Fosheim 
> Grøstad wrote:
>> On Tuesday, 24 February 2015 at 14:45:17 UTC, Marc Schütz 
>> wrote:
>>> It's possible to (ab)use the MMU as a write barrier.
>>
>> Uhm...
>>
>> The throughput for L/SFENCE is 5 cycles and SFENCE 33

(Typo,  MFENCE is 33...)

>> cycles... The cost of a page miss is 1000 cycles + overhead 
>> for copying.
>>
>> And that's assuming that you have enough memory and that the 
>> TLB isn't affected...
>
> Yes, but if the program has a small working set, you pay that 
> price only a few times (once per page), and in any case, only 
> during a running background scan, rather than always.

But if you can control where the code is running when you run the 
GC scan then you might as well have a separate code path for 
concurrent GC too (i.e. two versions of the code). One with 
fences and one without...

If you loose the TLB, then you also loose all caches too IIRC.


More information about the Digitalmars-d mailing list