[dmd-concurrency] shared arrays

Andrei Alexandrescu andrei at erdani.com
Wed Jan 27 17:34:01 PST 2010


Michel Fortin wrote:
> Le 2010-01-27 à 18:25, Andrei Alexandrescu a écrit :
> 
>> Consider a shared array:
>> 
>> shared int[] x;
>> 
>> What can be done with it? It's tricky; the array has two words
>> worth of info and we can't assume 128 bits can be atomically
>> written on a 64-bit machine.
> 
> Isn't that a great case for a lock pool controlled with a hash table?
> If you have dismissed that option, why?

I'm unsure whether that much magic is warranted, and I'm afraid that 
"arrays that suck" is the most likely result. Array primitive operations 
aren't quite meant to be individually synchronized, and in my experience 
higher-level APIs are almost always necessary.

Andrei


More information about the dmd-concurrency mailing list