[dmd-concurrency] D's Memory Model

Robert Jacques sandford at jhu.edu
Wed Feb 10 12:29:01 PST 2010


On Wed, 10 Feb 2010 15:14:12 -0500, Walter Bright <walter at digitalmars.com>  
wrote:
> Kevin Bealer wrote:
>>
>>
>> Would it be practical for particular cache lines to have some kind of  
>> affinity for a given local allocator or for a cache line with both live  
>> and data and garbage to have an affinity for one of the thread pools  
>> that already owns an object within it?
>>
>
> I don't know.

Yes, its possible. It requires DMD to give the GC allocator the type  
information (local/immutable/shared). The allocator can then make the  
capacities of shared objects to be multiples of the cache line size. These  
are properly aligned in D's current GC. Immutable objects would either  
have to be promoted as well, or draw objects under a cache-lines from a  
different set of free-list bins. The reason you can get away with  
immutable objects from different threads peacefully co-existing on a  
cache-line is that they are read-only, so there's no false sharing.


More information about the dmd-concurrency mailing list