Idiomatic D using GC as a library writer

Ali Çehreli acehreli at yahoo.com
Sun Dec 4 23:37:39 UTC 2022


On 12/4/22 15:25, Adam D Ruppe wrote:

 > which would trigger the write barrier. The thread isn't
 > allowed to complete this operation until the GC is done.

According to my limited understanding of write barriers, the thread 
moving to 800 could continue because order of memory operations may have 
been satisfied. What I don't see is, what would the GC thread be waiting 
for about the write to 800?

Would the GC be leaving behind writes to every page it scans, which have 
barriers around so that the other thread can't continue? But then the 
GC's write would finish and the other thread's write would finish.

Ok, here is the question: Is there a very long standing partial write 
that the GC can perform like: "I write to 0x42, but I will finish it 2 
seconds later. So, all other writes should wait?"

 > The GC finishes its work and releases the barriers.

So, it really is explicit acquisition and releasing of these barriers... 
I think this is provided by the CPU, not the OS. How many explicit write 
barriers are there?

Ali



More information about the Digitalmars-d-learn mailing list