Thread GC non "stop-the-world"

via Digitalmars-d digitalmars-d at puremagic.com
Tue Sep 23 03:08:08 PDT 2014


On Tuesday, 23 September 2014 at 09:04:48 UTC, Kagamin wrote:
> On Tuesday, 23 September 2014 at 00:15:51 UTC, Oscar Martin 
> wrote:
>> http://blog.mgm-tp.com/2014/04/controlling-gc-pauses-with-g1-collector
>>
>> (*) What if:
>> - It is forbidden for "__gshared" have references/pointers to 
>> objects allocated by the GC (if the compiler can help with 
>> this prohibition, perfect, if not the developer have to know 
>> what he is doing)
>> - "shared" types are not allocated by the GC (they could be 
>> reference counted or manually released or ...)
>> - "immutable" types are no longer implicitly "shared"
>>
>> In short, the memory accessible from multiple threads is not 
>> managed by the GC.
>
> A use case, which comes to mind: a game saves progress to the 
> server, the main thread prepares data to be saved (a relatively 
> lightweight operation) and hands it over to another thread, 
> which saves the data in background. How would you do it?

This can be done without sharing. Of course, a uniqueness concept 
would be needed.


More information about the Digitalmars-d mailing list