More radical ideas about gc and reference counting

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Tue May 13 10:22:19 PDT 2014


On Tue, 13 May 2014 12:14:06 -0400, Ola Fosheim Grøstad  
<ola.fosheim.grostad+dlang at gmail.com> wrote:

> On Tuesday, 13 May 2014 at 14:13:31 UTC, Steven Schveighoffer wrote:
>> I know this is coming from a position of extreme ignorance, but why do  
>> we have to do copy on write? What about pause on write?
>
> Not sure how that will help? Pointers may still escape collection?
>
> (but you get that with transactional memory, on the cache level)

My understanding is that the way the fork collector works is that it makes  
pages copy-on-write. Then if the original process writes to one of the  
pages, the page is copied, which may be expensive in terms of total memory  
and time consumed.

The idea I had was to make them pause-on-write. This means, when the  
original process attempts to write to the page, it gets a page-fault,  
which pauses the thread until the collector is done with it. This causes  
the same halting that normally happens with stop-the-world, but only  
on-demand, instead of preemptively. If a thread is doing only reads, or is  
only touching non-Scanned memory, it continues.

A collector may be able to take advantage of this knowledge to avoid as  
many pauses as possible, but I'm not sure.

Just an idea, I make no claims to its actual benefits :)

-Steve


More information about the Digitalmars-d mailing list